Hi all!
I am cloning an entity (model) via script.
I can clone and after that I enable it. Everything works.
this.seed = app.root.findByName("Old_P"); // Seed Entity
var clone = this.seed.clone()
clone.enabled = true;
//clone.rigidbody.activate();
//clone.rigidbody.enable = true;
var newGuid = this.guid()
clone.addLabel(newGuid);
var nameprefix = "NewSpawTruck__";
var newName = nameprefix.concat(newGuid)
clone.setName(newName);
this.entity.addChild(clone); // Add it as a sibling to the original
The problem is that I cannot set the position of this new clone.
It appears only at the same position of the original entity … no matter if I change with the method SetPosition.
I printed before and after the entity.setPosition( ) … nothing changes.
So I discovered that it worked if the RigidyBody of the original entity is disable.
Great.
The problem is that I can not do it through script.
clone.rigidbody.enable = true;
This line makes no difference.
Does anybody know if I am doing something wrong?
thanks
daniel
My scene is:
https://playcanvas.com/editor/scene/366841
and the entity is: PivotTruck (for example).