Hi guys , I am planning to drop a sphere over the path I created on blender.
it is supposed to roll over the surface and fall into the torus at the end of it but instead it is passing through , like the image:
Is there some property I need to add from blender ?
This the class that renders the ground , the path and the sphere:
import { MeshBuilder, PhysicsAggregate, PhysicsShapeType, Scene, SceneLoader } from '@babylonjs/core'
import "@babylonjs/loaders";
export class Ramps {
constructor(private scene: Scene) {
this.createGround();
this.createRamps();
this.dropBall();
}
createGround(): void {
const { scene } = this
const mesh = MeshBuilder.CreateGround('ground', { width: 20, height: 20 }, scene)
new PhysicsAggregate(mesh, PhysicsShapeType.BOX, { mass: 0 }, scene)
}
async createRamps(): Promise<void> {
const ramps = await SceneLoader.ImportMeshAsync(
"",
"./model/",
"rampa.glb",
this.scene
);
}
dropBall(): void {
const ball = MeshBuilder.CreateSphere('myBall', { diameter: 2, segments: 32 }, this.scene)
ball.position._y = 30;
ball.position._x = -9;
ball.position._z = 3;
new PhysicsAggregate(ball, PhysicsShapeType.SPHERE, { mass: 1, restitution: 0.75 }, this.scene)
}
}
btw :
1 - The sphere bounces ok on the ground.
2 - I would like to reproduce it on sandbox so I can share , but I dont know how to upload my glb model … is it possible ?