Page 1 of 1

Do I need to add anything to this method to reset an entity?

Posted: Thu Jan 06, 2011 10:25 pm
by Spankenstein
I would like to reset an entity is there anything I need to do other than the following:

Code: Select all

            entity.LinearVelocity = new Vector3();
            entity.AngularVelocity = new Vector3();
            entity.InternalWorldTransform = Matrix.Identity;
Or should I just use:

Code: Select all

           entity.MotionState = MotionState.DefaultState;

Re: Do I need to add anything to this method to reset an entity?

Posted: Thu Jan 06, 2011 10:37 pm
by Norbo
Both should work. That will put it back at identity orientation and 0,0,0 position with no velocity.

Those are using buffered properties, though. They will require an update before it takes effect. Use the internal-prefixed properties to bypass buffering. (v0.15.0 is moving buffered properties into a more appropriate location so they aren't used by default)

Re: Do I need to add anything to this method to reset an entity?

Posted: Thu Jan 06, 2011 10:43 pm
by Spankenstein
Sorry, you're right. I tend to write the code in a hurry and forget to add Internal when posting questions :oops: