Can Physics (/chipmunk) have a speedlimit ignoring externals

Get help using Construct 2

Post » Tue Nov 10, 2015 2:26 am

I'm trying to make a game with physics and hitting up against a problem.

I need to have rocket engines that will only go so fast, BUT the ship should be able to go faster if an external force makes it.

So the rocket engine has a top speed of 100 pixels-per-second and the player could never exceed it, unless for instance the player is being pulled towards a black-hole.

Chipmunk physics has a top speed option but it will also effect external forces.

Is there a way to do this? Or maybe is there a formula for reducing thrust based on speed and angle of motion?

Thanks!
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074

Post » Tue Nov 10, 2015 2:49 am

You would need to project the current velocity vector onto the direction vector of the thrust:
https://en.wikipedia.org/wiki/Vector_projection
And measure whether the projected vector is lower than the maximum velocity allowed. If it is lower, then it would be okay t add thrust in that direction.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395


Return to How do I....?

Who is online

Users browsing this forum: GrogIsGood, kainrazial and 4 guests