I’m comparing unity vs babylon.js for 3d games. I’m following a tutorial for unity on youtube (How to make a Video Game in Unity - MOVEMENT (E03) - YouTube), and trying to recreate what he does in babylonjs. In the tutorial, he removes friction to stop the body from rotating, and uses forces for movement in the x axis.
However, when I tried to do this in babylon, the body starts moving in one direction and doesn’t stop. This makes sense as it’s what would happen in the real world if there was no friction, but I want to do the same thing he’s doing. The best way I can think of for doing this is by using friction, but somehow make it affect only the linear velocity instead of both the linear and angular velocity. Is there any way to do this? I tried another way, incrementing/decrementing the player’s x position , but this looks weird and not natural at all
adding @RaananW - he’s helped me before
1 Like
Adding @Cedric as well
1 Like
I think you need forces like in your video. This will allow progressive acceleration.
Also, take a look at this thread : damping, friction and restitution - Real-Time Physics Simulation Forum
You can keep friction and set angular damping so that the physics object doesn’t rotate at all.
2 Likes
Thanks, @Cedric! If I set the angular damping, then the collisions won’t work properly, but you set me on the right track I’m using linear damping instead. A value of 0.8 makes everything work perfectly now - the box stops moving almost as soon as I release the button, but not at the exact moment, just the way I wanted it.
3 Likes