I’m trying to learn by creating a simple pong clone and so far I’m not doing well.
I have a simple Pawn Class as my PlayerPawn.
In the blueprint which inherits my Pawn class I added a simple box as visual representation.
Now I am moving it on one axis with the “MoveRight” event, which is kind of working.
In the MoveRight method I get the current Location of the Actor, add the value of movement and set the new Location of it using SetActorLocation.
But I also want to constrain the movement to a specific area, for example, a simple square on the ground, and I should not be able to move out of it.
I tried adding blocking objects around the edges, but it appears that setting the location ignores me all blocking elements, I can just “fly” through them.
I feel like in generally this is the wrong approach to move the Pawn.
The controls feel mushy when using the mouse and I don’t know if MoveRight already calculates in deltatime, does it behave the same on different framerates?
I thought about moving things manually in the Tick method instead.
For the restricted area I would just check if the actor is in a certain range and just resetting its position if it goes out of bounds instead.
What is the usual way of doing something like this?