2
\$\begingroup\$

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Ah, well it looks like you found the answer at the same time. \$\endgroup\$ Commented Aug 23, 2013 at 23:37

1 Answer 1

3
\$\begingroup\$

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

\$\endgroup\$
1
  • \$\begingroup\$ I'll give it a shot and report back. As you pointed out, documentation is comparable to that of three.js, so who knows. \$\endgroup\$ Commented Aug 23, 2013 at 23:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.