Using Physijs which uses ammo.js.

I am attempting to simply place a sphere on top of a box, the box is moving back and forth and I want the sphere to move with it while also being able to move on top of it.

I am already handling moving the object with setLinearVelocity but even with max friction the sphere doesn't "stick" to the box. I've tried increasing sphere velocity based on box speed but it doesn't seem to work.

Should this be working or am I on the wrong track? I've been stuck on this for quite a while and have tried every solution I can think of or find (and you can't find much on physijs). Perhaps I should try to get rid of Physijs entirely and just use ammo.js if I am trying to do these more advanced physics? (there will be much more to be added)

Hope my question is clear, and please let me know if you need code samples but it will be difficult to provide a good sample since my code is all modular and split up.

bumped to the homepage by Community 5 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

I discovered that I needed to do the following:

Set the moving cube with weight of 1 and then setLinearFactor to x,0,x and setLinearRotation to 0,0,0. This allowed me to use setLinearVelocity as expected and then increase the velocity of my sphere on top of the cube accordingly.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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