403
403
void SumoPhysicsController::WriteMotionStateToDynamics(bool)
406
m_MotionState->getWorldPosition(tmp[0], tmp[1], tmp[2]);
408
m_sumoObj->setPosition(pos);
409
m_MotionState->getWorldOrientation(tmp[0], tmp[1], tmp[2], tmp[3]);
410
MT_Quaternion quat(tmp);
411
m_sumoObj->setOrientation(quat);
407
413
// this is the actual callback from sumo, and the position/orientation
408
414
//is written to the scenegraph, using the motionstate abstraction
503
///////////////////////////////////////////////////////////
504
///A small utility class, SumoDefaultMotionState
506
///////////////////////////////////////////////////////////
508
SumoDefaultMotionState::SumoDefaultMotionState()
510
m_worldTransform.setIdentity();
511
m_localScaling.setValue(1.f,1.f,1.f);
515
SumoDefaultMotionState::~SumoDefaultMotionState()
520
void SumoDefaultMotionState::getWorldPosition(float& posX,float& posY,float& posZ)
522
posX = m_worldTransform.getOrigin().x();
523
posY = m_worldTransform.getOrigin().y();
524
posZ = m_worldTransform.getOrigin().z();
527
void SumoDefaultMotionState::getWorldScaling(float& scaleX,float& scaleY,float& scaleZ)
529
scaleX = m_localScaling.x();
530
scaleY = m_localScaling.y();
531
scaleZ = m_localScaling.z();
534
void SumoDefaultMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)
536
MT_Quaternion quat = m_worldTransform.getRotation();
543
void SumoDefaultMotionState::getWorldOrientation(float* ori)
545
m_worldTransform.getBasis().getValue(ori);
548
void SumoDefaultMotionState::setWorldOrientation(const float* ori)
550
m_worldTransform.getBasis().setValue(ori);
552
void SumoDefaultMotionState::setWorldPosition(float posX,float posY,float posZ)
554
MT_Point3 pos(posX,posY,posZ);
555
m_worldTransform.setOrigin( pos );
558
void SumoDefaultMotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)
560
MT_Quaternion orn(quatIma0,quatIma1,quatIma2,quatReal);
561
m_worldTransform.setRotation( orn );
564
void SumoDefaultMotionState::calculateWorldTransformations()