Hi,
I’m trying to set up a movement component for my custom pawn. Its a pong game so character movement component doesn’t fit because of the sphere collision and i want a box collision.
I find it pretty hard to set up in comparison to the setactorlocation which is dead simple
Which hurds do you see in the setactorlocation method? can AI be set up with setactorlocation? what would you do?
thanks
You are free to use setactorlocation if you like, movment componets is just ready movement code which can be replaced with your if you want.
yes this is true. if i look in the floatingmovementcomponent there are a lot of things happening like ConsumeInputVector(), SafeMoveUpdatedComponent(), UpdateComponentVelocity(). so higher level stuff. But does setactorlocation prevent me from using AI in the movement when my pawn is used by an AI Controller?
I’mnot sure, you can always make your own movment component too
I’ve been looking into this stuff recently. Im still trying to figure out some of the details, always try to verify it yourself… But if you look at source, SetActorLocation ends up calling:
RootComponent->MoveComponent( ... )
And if you look at GetActorLocation it ends up just returning
RootComponent->GetComponentLocation()
GetActorLocation and SetActorLocation just interacts with the RootComponent. If you compare that to MovementComponents when it calls SafeMoveUpdatedComponent() you’ll see, if you go far enough down the rabbit hole, that it calls the same MoveComponent function on whichever component is currently set as the UpdateComponent (For characters, this is the root component I believe).
So really, it kinda does the same thing. Its just one is convenient and the other involves a more complicated system which uses different physics implementations to determine where the component should move.