gbz
July 7, 2020, 12:23am
1
Hi all!
Is there a way to stop a SphereImpostor
from sliding on a flat plane?
Please find a link to the Playground here: https://www.babylonjs-playground.com/#3EDS3A#42
Please click inside the Playground scene to activate pointer lock.
Keys:
WASD: Move
SPACE: Jump
Replacing SphereImpostor
with BoxImpostor
can stop the bottom
mesh from sliding, even with friction: 0
for both the bottom
mesh and ground
mesh.
bottom.physicsImpostor = new BABYLON.PhysicsImpostor(bottom,
BABYLON.PhysicsImpostor.SphereImpostor, {
mass: 1,
restitution: 0,
friction: 9999999999
}, scene);
The goal is to have this bottom
sphere serve as the bottom portion of a capsule for player physics
Thank you for your help
gbz
July 7, 2020, 12:40am
2
gbz
July 7, 2020, 3:23am
3
Added bottom.physicsImpostor.physicsBody.angularDamping = 1
, which reduces a lot of sliding. However, there is still a little bit of sliding while on the red slide.
https://www.babylonjs-playground.com/#3EDS3A#47
Reference: physicsBody: angularDamping/linearDamping question
To achieve the physically impossible, you will have to go to the weird realm of sleeping objects!
https://www.babylonjs-playground.com/#3EDS3A#52
When the two collide, put the sphere to sleep. You can call wakeUp whenever you want to keep it going.
Not sure about your usecase, but that would be the way to go for me. Either that or constantly setting liner velocity to 0,0,0 on each frame.
2 Likes
gbz
July 7, 2020, 8:29am
5
Thank you so much for your awesome suggestions, @RaananW
1 Like