How to disabel/enable entity rigid body?

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.enable = true;

        var newGuid = this.guid()
        var nameprefix = "NewSpawTruck__";
        var newName = nameprefix.concat(newGuid)

        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.

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?


My scene is:
and the entity is: PivotTruck (for example).

Use pc.RigidBodyComponent#teleport. Otherwise the physics engine still thinks the entity is in the original location.


It worked!
Now I remember the Playcanvas tutorial. There is an example with that.

Really thanks.