In that why sphere not move on ground can you help me?

here is playground

Hey @dodiya,
I don’t see any ground in the provided PG.
Could you specify what you are trying to achieve?

in playground i will pass ground like this : “","final7.glb”,

so is there my mistake to pass ground in playground

I see that in the console there are CORS errors

Access to XMLHttpRequest at ‘Balltracking/images/final7.glb at main · Pramoddodiya08/Balltracking · GitHub’ from origin ‘’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Please read first

pls refer this link and now help me

Wait for the ground to be loaded before creating the ball impostor. Babylon.js Playground (

1 Like

pls check this

Do you have any further questions?

my question remain unsolve when i press w then sphere goes inside ground that i dont want i want that when i press w then sphere move on ground

Babylon.js Playground (

Each of the road mesh’s sections is unparented and assigned a mesh impostor.


yes got it thanks a lottttttt…

yes work but can u explain what u do ??

Of course. What would you like me to explain? The road mesh’s impostors? If it’s that, what I did first was to check the mesh’s structure in the inspector:

I also turned on and off the bounding boxes on each section to understand how they were distributed:

Given that the road is composed of multiple sections, it is better that each section has its own impostor, to make the collision work precisely. Besides that, instead of using a box impostor, we’ll want to use mesh impostors, because the box impostors won’t work well with the elevations on the road. You can see it if you change the code to use box impostors and turn on the physics debug view:

compared with the mesh impostor, which follows much better the shape of the road:

Having selected which type of impostor I wanted, in lines 38 to 48 I’m iterating through each of these road sections, baking their transforms and unparenting them. The reason I did this is because Physics Impostors don’t work as well if the mesh has a parent. This isn’t a problem in the physics V2 API, but I didn’t want to change the example. After unparenting, I create an impostor for each section.


1 Like

in that now i use follow camera but when track curve left/right then follow camera not actually move, only sphere move left right i want follow camera also rotate with sphere

For your case, I think it would be better to use a different type of camera. The Follow Camera depends on the tracked object’s orientation, and since the sphere is rolling continuously, its orientation will keep changing which will make the camera move too much. Instead of that, I’m using a regular Universal Camera and keeping track of the general direction of the sphere with the sphereDirection variable. I’m also making the movement of the sphere depend on this. Whenever I press A/D, I rotate this sphereDirection, and I’m also setting the camera relative to that: Babylon.js Playground (