Rambo
17-07-2007 14:21:56
I have world without gravity and I try move object in space.
This is my code, but is wrong.
If I change this to addForce its work, but I don't know how to stop the ship.
This is my code, but is wrong.
//oblicz droge z punku A do B
m_Direction = m_NextPos - m_ShipNxBody->getGlobalPosition();
m_Distance = m_Direction.normalise();
Real move = (this->getSpeed() * elapsedTime)+1;
m_Distance -= move;
m_ShipNode->translate(move*m_Direction); <-- this is bad ??
m_ShipNxBody->setGlobalPosition(m_ShipNode->getPosition());
if (m_Distance<=0)
{
m_ShipNxBody->setGlobalPosition(m_NextPos);;
if (!m_WalkList.empty())
m_NextPosition=true;
else
this->m_ShipState=ShipState::SS_STAND_BY;
}
If I change this to addForce its work, but I don't know how to stop the ship.