Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
1  
Ah, well it looks like you found the answer at the same time. –  Byte56 Aug 23 '13 at 23:37

1 Answer 1

up vote 1 down vote accepted

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".

share|improve this answer
    
I'll give it a shot and report back. As you pointed out, documentation is comparable to that of three.js, so who knows. –  Micah - ps I love you Aug 23 '13 at 23:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.