Download

Override GetActorLocation, GetActorRotation etc.?

Hello,

can you override GetActorLocation()? I don’t think so. So what if the real moving component in an Actor is not the root component, but for example a static mesh? This can happen for example if the updated component in the ProjectileMovementComponent is set to another component than the root component. Would you use an interface like MovingActor with GetMovingLocation, GetMovingVelocity, GetMovingRotation etc. functions where the Actor then can override it?

It’s not always possible that the moving component is also the root component. For example if you make a base class and doesn’t want to put any component in it, you cannot make another component in a derived class the root component. So if you would add a ProjectileMovementComponent in this derived class for a static mesh, you would have to set it as the updated component in the projectile movement component. But then it would “fly away” from the root component and GetActorLocation would never change.

Is there a better solution for this than a interface with GetMovingLocation, GetMovingVelocity etc.?

Thanks,

Thilo

I don’t really understand the question. What are you trying to achieve? Actors contain components, and the root component is just the upper most component. You can’t replace the “actor”. A component attached to the actor will always move with the actor, the only thing that can change is the offset of this component. The ProjectileMovementComponent moves the actor, not a component inside the actor, so GetActorRotation will return the location of the projectile correctly.

Sure a ProjectileMovementComponent **can **only move a component inside an actor. You can set the updated component with SetUpdatedComponent. As default it is using the root component.

@ThiloN1987 Well shit, you are right. This seems very weird to me though. Anyways, you can get the location of a component via GetWorldLocation node. GetWorldLocation | Unreal Engine Documentation