Does anyone know how to accelerate and de-accelerate an object in zero gravity in PhysLite? As in Example2 which is a top down asteroids example, I'd like it so when you release the UP key the vessel slows down until stopped, but I haven't got a clue how? I've tried this but it totally screws the physics up!
m_angle = m_body.GetRotation()
m_x:Float = Cos(m_angle) * m_speed;
m_y:Float = Sin(m_angle) * m_speed;
If KeyDown(KEY_LEFT) Then m_body.Spin -.1
If KeyDown(KEY_RIGHT) Then m_body.Spin +.1
If KeyDown(KEY_UP) Then
m_speed:+0.01;
Else
m_speed:*0.09;
EndIf
m_body.MassSetVelocity(index, m_x, m_y) ;
|