PDA

View Full Version : Applying Velocity to KActor



ninjabadger
11-15-2009, 06:28 PM
Is there a way to adjust the velocity of a KActor after you have applied an Impulse.

I want to cap the velocity or add an acceleration in X / Y but calling this:

Velocity = newVelocity;

or

Velocity.X += Spin.X;

Is having no effect

rajiv
04-01-2011, 08:15 AM
Did you ever solve this problem? I'm running into the same thing.. Anyone have a clue?

watslash
04-01-2011, 09:44 AM
You have to apply the velocity change to the mesh component, not the KActor itself.
Example:
(I'm not sure if this is the real code or not but it should get you in the right direction)

StaticMeshComponent.Velocity = NewVelocity;

shatty
04-01-2011, 10:41 AM
StaticMeshComponent.SetRBLinearVelocity or SetRBAngularVelocity. That is to set the velocity.

Iritus
04-03-2011, 08:11 PM
KActors (or any actor with it's physics set to PHYS_RigidBody) can only have their velocity directly modified by accessing the primitive component being used to calculate the rigid body physics.

StaticMeshComponents are typically used to calculate rigid body physics, and are (eventually) descended from PrimitiveComponent, which has the following function:


/**
* Set the linear velocity of the rigid body physics of this PrimitiveComponent. If no rigid-body physics is active, will do nothing.
* In the case of a SkeletalMeshComponent will affect all bones.
* This should be used cautiously - it may be better to use AddForce or AddImpulse.
*
* @param NewVel New linear velocity to apply to physics.
* @param bAddToCurrent If true, NewVel is added to the existing velocity of the body.
*/
native final function SetRBLinearVelocity(vector NewVel, optional bool bAddToCurrent);

For example, the following code would cause a KActor stop moving.


StaticMeshComponent.SetRBLinearVelocity(vect(0,0,0 ));

The PrimitiveComponent class has a number of functions that pertain to accessing or manipulating rigid body physics, most of them can be easily identified by looking for the letters RB (for Rigid Body) in the function name.

Blade[UG]
04-03-2011, 08:20 PM
I think KActor does have a Maximum Velocity variable that can be enabled