Results 1 to 6 of 6
  1. #1
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    45

    Default Applying Velocity to KActor

    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

  2. #2
    Skaarj
    Join Date
    Mar 2011
    Location
    The Netherlands
    Posts
    23

    Default

    Did you ever solve this problem? I'm running into the same thing.. Anyone have a clue?

  3. #3
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Posts
    42

    Default

    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;

  4. #4
    MSgt. Shooter Person
    Join Date
    May 2010
    Posts
    53

    Default

    StaticMeshComponent.SetRBLinearVelocity or SetRBAngularVelocity. That is to set the velocity.

  5. #5
    MSgt. Shooter Person
    Join Date
    Sep 2010
    Location
    Plano, TX
    Posts
    119
    Gamer IDs

    Gamertag: PookisaurusRex

    Default

    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:

    Code:
    /**
     * 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.

    Code:
    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.

  6. #6
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    I think KActor does have a Maximum Velocity variable that can be enabled
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.