I want to spawn a wall with a rigid body.
Every wall can have a different length. So i scale the wall along the x-axis.
After i scale (and rotate) it i perform “syncTransform”.
What happens is that every rigid body of previously spawned walls gets updated to the length of the newest wall.
as an example:
spawn wall_1
wall_1 is 3 units long → syncTransform
wall_1 is okay
spawn wall_2
wall_2 is 5 units long → syncTransform
wall_2 is okay
wall_1 looks okay but rigid body is now 5 units long (2 units of invisible wall)
spawn wall_3
wall_3 is 1 unit long → syncTransform
wall_3 is okay
wall_1 and wall_2 still looking okay but have a too short rigid body of 1 inut.
here is the code:
iron.Scene.active.spawnObject('NormWall', null, function(o:Object) { //position o.transform.loc.x = startpoint.x; o.transform.loc.y = startpoint.y; o.transform.loc.z = startpoint.z; //length o.transform.scale.x = distance; //rotation o.transform.rot.fromAxisAngle(new Vec4(0, 0, 1), angle); o.transform.buildMatrix(); o.getTrait(RigidBody).syncTransform(); }, false);
here is an example image of 2 walls created by this code. I marked the rigid body of Wall_1.
is there a way i get an independent rigid body for every wall?
EDIT:
Okay this behavior is only on “mesh” mode: