Game Development Community

Turn off Physics

by Martin Banks · in Torque 3D Professional · 01/04/2010 (1:00 pm) · 6 replies

How can I either:

1. Toggle physics for a given level.

2. Toggle physics for a given item or character.

?

Thanks in advance.

#1
01/04/2010 (2:44 pm)
What do you mean "to toggle physics" ?
To lock a item in the space ?
All object's physics affect their velocity,so you can zero it (at some point).

For example in the player class you can set in updateMove():
mVelocity.zero();
You'll have to be careful,because velocity is critical for collisions.
#2
01/04/2010 (2:50 pm)
@Picasso

By "toggle physics" I mean go from calculating rigid body movements, to not doing so, and vice versa.

setting mVelocity to zero won't do it because delta.warpoffset is always set in unpackupdate(), then in processTick the opposite of this value is assigned to delta.posVec, then in updatePos posVec is set to newPos whenever mVelocity is zero, newPos is then passed to setPos() which is applied to the transform of the object.
#3
01/04/2010 (3:45 pm)
It will be good if you have a good example to explain what exactly you are attempting to do.
If i understand correctly warping is used to correct the client-server latency,so you don't have to worry about it.
#4
01/05/2010 (8:26 am)
What do you want? Stop the character from moving at all? Disabling collisions? So far you're being too vague for we to be of any help.
#5
01/05/2010 (11:41 am)
@Manoel

I'm just trying to prevent physics from affecting either an entire scene, or an individual objects movement.

I think I have figured it out. By setting a shapebase derived object's mGravityMod to false, you can disable physics on that object. But, I still would like to know how to turn it off for an entire scene.
#6
01/19/2012 (6:04 am)
Does this remove that calls to check physic's when someone runs into an object? I don't need complex physics for my game, just basic stuff, you run into a wall you can't go any farther. If you fall off a cliff you fall to the ground below you. etc. But I don't need much more than that.