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 : âhttps://github.com/Pramoddodiya08/Balltracking/blob/main/images/","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 âhttps://playground.babylonjs.comâ 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 (babylonjs.com)
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 (babylonjs.com)
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.

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 (babylonjs.com)



