-
2nd August 2015, 06:05 PM
#33
For the correct bounce you can just invert the velocity component along the triangle's normal (you need to project your velocity vector onto the triangle's normal) (the triangle where the ship hit the ground).

In terms of projection, if "a" is your velocity vector and "b" your triangle normal, "a1" will be the velocity component along the triangle normal.
However, to simplify things you can just do what you're doing by just using the vertical component of your velocity (y in your case). Although in steep hills the ship will behave a bit odd.
You do like: velocity=-velocity*damp_factor. The damp factor is a number between 0 and 1, it defines the bounciness of the ship when it hits. A damp factor of 1 means the ship will bounce back up with the same velocity it hit the ground, 0 means it won't bounce, it'll just hit and stay there.
If you chooe to go with the projection method you then have to "move back" and rebuild the velocity vector with the new inverted component, you can do that by adding the modified component "a1" to the other component "a2".
Last edited by Xpand; 2nd August 2015 at 06:16 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules