Impulse position doesn't update


#1

Hello!

I believe I have found a bug in the engine.
Take a look a this playground: https://www.babylonjs-playground.com/#BEFOO#347
Its just a simple scene, a ball and plane with physics.
press space. the ball comes at the camera, right?
Well, no. after it goes past, when space is pressed the impulses will ALWAYS be applied to the original impulse direction. It NEVER adjusts.

If anyone can try to fix this that would be GREAT!

Givo


#2

Adding @trevordev for the Physx part


#3

Hey thanks! I’m reworking my game’s player physics (Demo HERE WASD move, c toggles crouch, f toggles freecam, Shift is sprint, right click to aim) the player slides down the 45 degree angled slope, and I can’t add jump. I’m switching to a custom physics based player with the camera being the child, and when working on the moving that bug popped up.

Thanks for the help!


#4

The first parameter of applyImpulse is the direction of the impulse, not the position to travel to. If you get the vector from the sphere to the camera and use that instead it should work. See: https://www.babylonjs-playground.com/#BEFOO#350


#5

Thanks! my mistake.