Assume I have a simple Physijs object like this car. How can I adapt something like this to "jump" (hydraulics ftw!) when pressing spacebar for instance?
I'm currently thinking applyCentralImpulse should come into play.
Assume I have a simple Physijs object like this car. How can I adapt something like this to "jump" (hydraulics ftw!) when pressing spacebar for instance?
I'm currently thinking applyCentralImpulse should come into play.
Well, the documentation is apparently non-existent at this point, but searching the source yields the following:
applyCentralImpulse = function ( force )
So, create a vector pointing up, upVector.set( 0, jumpFactor, 0 );, then use applyCentralImpulse to the vehicle to make it jump.
Alternatively, you can use applyImpulse ( force, offset ) and supply an offset to position the force under the front wheels, thereby giving your hydraulics "the win".