Game Development Community

Changing A force During runtime.

by Josef Schalk · in Torque X 2D · 08/17/2009 (11:53 am) · 2 replies

Hi

How can i change the value of a force ie T2dforcecomponent.

at the moment i have this.

if (_sceneObject.Physics.VelocityX < 5.0f )
            {
                // settle object velocity to 0 once below <5f
                _controlMyForce.Value = 0f; 
            }

So what i want to do is once objects velocity falls below a certain speed, i want the t2dforcecomponent to stop putting a force on the object.
_controlMyForce = Owner.Components.GetInterface<ValueInterface<float>>("float", "MyForceName");
thats how i defined _control my force.

So I added this as a component to the object, and it has no effect.

Any suggestions?

#1
08/27/2009 (4:58 am)
I'd also like to know this. Anyone else have an idea about this? I've tried what Josef did and it doesn't seem to work for me either.
#2
08/27/2009 (4:37 pm)
From what I understand you would have to get the ValueInterface value and apply it to your physics component. I believe I have used a value interface in a component owned by an object.