Hi,
I’m working on a topdown space shooter game for the mobile device and I need a way
to stop the player ship from moving off the screen.
In the Playership actor(pawn blueprint), “SetActorLocation” is used to move the player location and after that
I use this clamp function to limit the movement, but how do I get it work at the screen edge.
This is what I have so far.
At the moment those are just fixed values (-100,100) for the min and max clamp values, but I’m kinda stuck
on figuring out how to get those clamp values from or depending on the screen size
I have tried several ways like getting the screen size (X & Y)and divide those by half and use it for the
min and max clamp values, but no luck
I have failed trying to get this to work since this week !!
“Project World to Screen” coupd help… Never tested it either…
My idea would be to Project the Position of the Player to screen coordinates, and ask if the player is outside screen width/height…
Even tho this is 2 years old, Nobila would need to set the velocity of the movement in that particular direction to zero (for those scoping for answers), cheers!