What would be the best way to animate the sphere?

I needed to make an animation similar to this video, the ball jumping and going to a SPECIFIED number.
I tried using the camera script on the sphere, it seems to work fine, but it’s not as real because it doesn’t seem to have “Physics”.

I’m new to play-canvas, and I needed to know which is the best way or if there’s an example of making the ball jump somewhere or something?

this is my project using camera path: PlayCanvas 3D HTML5 Game Engine

I’ve not done this before but the approaches I would think about:

  1. Not use physics at all and have at least one animation per number

  2. Use physics but cover all the numbers but the one you want so it can only land in a particular number. Add some extra logic to do impulses to steer it towards the number. Not a huge fan of this and would need to see try it to see if it would work.

  3. Use a physics library that was deterministic and run the sim until I had initial values for velocity, current position and rotation etc for every number at least once.


I think considering this is a circle, you just need to simulate (outside of playcanvas) hitting any number - and export that as an animation. Then you all you need to do is to adjust a starting position of when to play the animation, while the sphere travels around the top, to hit any number. For variation, you’d probably export few different animations.


You can do a forward simulation. Create an empty physics world, add the roulette and the ball. Do a normal dynamic simulation of a ball running/spinning/jumping around and then stopping in some slot. On each simulation step you would record the ball position and the roulette rotation quaternion. Destroy the world.

That should take about 300-500 steps, which you can calculate within a single frame, after which you can just animate recorded positions of the ball and offset the initial rotation of the visual model of the roulette, so the ball would end up in the selected slot.

This will be deterministic, even in Ammo, so you can send only the ball impulse to all clients, and it will animate the same way for everyone.