00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #include "../include/IPSA/ipsaclasses.h"
00028 #include "../include/IPSA/viewer/instructions/GetBodyPosition.h"
00029
00030 #include <sstream>
00031
00032 Instruction::tExecResultType GetBodyPosition::vExecute(std::vector<std::string>& Instr, std::ostringstream& answer, unsigned int& numberOfReturnValues)
00033 {
00034 numberOfReturnValues = 0;
00035 tExecResultType res = eBODY_NOT_FOUND;
00036 SoPhysics* phy = Instruction::GetNodeOfTypeByName<SoPhysics*>(Instr[1]);
00037 if (phy)
00038 {
00039 SbVec3f position = phy->getCurrentPosition().getValue();
00040 answer << std::scientific << position[0] << ' ' << position[1] << ' ' << position[2];
00041 numberOfReturnValues = 3;
00042 res = eOK;
00043 }
00044 else
00045 res = eNODE_IS_NOT_A_BODY;
00046
00047 answer << '\r' << std::endl;
00048 return res;
00049 }