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

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Spankenstein
Posts: 249
Joined: Wed Nov 17, 2010 1:49 pm

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

Post 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;
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

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

Post 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)
Spankenstein
Posts: 249
Joined: Wed Nov 17, 2010 1:49 pm

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

Post by Spankenstein »

Sorry, you're right. I tend to write the code in a hurry and forget to add Internal when posting questions :oops:
Post Reply