Announcement

Collapse
No announcement yet.

Velocity on my MovementComponent does nothing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Velocity on my MovementComponent does nothing

    Hello,

    I write my own MovementComponent and I have a little problem with it.
    I have a PlayerAvatar which inherit from APawn. PlayerAvatar create an AvatarMovementComponent (which inherit from UPawnMovementComponent) and keep it as a properties:

    Code:
        UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = MyPawn)
        UAvatarMovementComponent* _movementComponent;
    This component tick so i'm pretty sure i had correctly created it. In this class (AvatarMovementComponent), i change Velocity to make my own gravity but the problem is that the Velocity is constantly growing and does nothing in game.
    I thought that maybe I forget to activate the physic on the object and tried SetSimulatePhysics(true) in PlayerAvatar and it activated the built-in gravity on my object but Velocity was still unused. What am I missing?

    Regards

    #2
    Velocity isn't applied by default, you have to do that yourself.

    Code:
    	/** Update ComponentVelocity of UpdatedComponent. This needs to be called by derived classes at the end of an update whenever Velocity has changed.	 */
    	virtual void UpdateComponentVelocity();
    -Camille

    Comment


      #3
      The weird thing is that i call this function each tick just after updated Velocity... I also found that AddMovementInput doesn't work either. Maybe these two problems are linked together..

      I tried to use setLinearVelocity to the capsuleComponent which is set to the UpdatedComponent of my movementComponent... and it works So maybe i forgot something at the initialization?

      Comment

      Working...
      X