The emerging game physics looks better that I was expecting. There is a lot of things going on behind the scene:
- tilting the ship depending on the current velocity and previous rotation,
- bouncing when trying to land on objects other than landing platform on when colliding,
- decreasing ship condition after each impact (not exposed to the GUI jet).
- bouncing when trying to land on objects other than landing platform on when colliding,
- decreasing ship condition after each impact (not exposed to the GUI jet).
The 'tilting' code so far is very simple:
function player::onUpdate()
{
%desiredRotation = $player.getLinearVelocityX() ;
%newRotation = %desiredRotation - $player.getRotation();
$player.setRotation( $player.getRotation() + %newRotation / 10 );
}
Although it took me a while to figure out, that to enable onUpdate() calls one has to do the following:
$player.enableUpdateCallback();
Learning the hard way ;)
No comments:
Post a Comment