Skip to content

Initialization of BoxImpostor and CannonJSPlugin #7928

@joergplewe

Description

@joergplewe

see https://forum.babylonjs.com/t/initialization-of-boximpostor-and-cannonjsplugin/9515

Moving meshes (e.g. mesh.position.y = 3) AFTER creating a BoxImpostor during initialization phase (means before first physics update cycle) causes a big initial velocity.

This is only the case with the CannonJSPlugin.

Expected: Mesh is just positioned at the given place.
Found: Mesh erratically moves around.

const SHOW_BUG = true;
var box = BABYLON.MeshBuilder.CreateBox("box", {}, scene);
if (!SHOW_BUG) { box.position.y = 3; }
var impostor = new BABYLON.PhysicsImpostor( box, BABYLON.PhysicsImpostor.BoxImpostor, { mass: 1}, scene);
if (SHOW_BUG) { box.position.y = 3; }

https://playground.babylonjs.com/#6HFBC4#1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions