00001 /* 00002 * Copyright (c) 2007, 2008, 2009, University of Karlsruhe (for members see AUTHORS file) 00003 * 00004 * ISC License 00005 * 00006 * Permission to use, copy, modify, and/or distribute this software for any 00007 * purpose with or without fee is hereby granted, provided that the above 00008 * copyright notice and this permission notice appear in all copies. 00009 * 00010 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 00011 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 00012 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 00013 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00014 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00015 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 00016 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00017 * 00018 * Created by Alexander Bierbaum 00019 */ 00020 00027 #include "../include/IPSA/ipsaclasses.h" 00028 #include "../include/IPSA/viewer/instructions/SetBodyVelocity.h" 00029 00030 00031 Instruction::tExecResultType SetBodyVelocity::vExecute(std::vector<std::string>& Instr, std::ostringstream& answer, unsigned int& numberOfReturnValues) 00032 { 00033 numberOfReturnValues = 0; 00034 tExecResultType res = eBODY_NOT_FOUND; 00035 SoPhysics* phy = Instruction::GetNodeOfTypeByName<SoPhysics*>(Instr[1]); 00036 if (phy) 00037 { 00038 SbVec3f vel((float)atof(Instr[2].c_str()), 00039 (float)atof(Instr[3].c_str()), 00040 (float)atof(Instr[4].c_str())); 00041 phy->setLinearVel(vel); 00042 res = eOK; 00043 } 00044 else 00045 res = eNODE_IS_NOT_A_BODY; 00046 00047 return res; 00048 }
Generated on Sat Mar 10 20:00:15 2012 for IPSA by 1.5.8 |