Does anyone know how to restrict the movement of a pawn to just move within the screen limits. For example I am trying to build a simple Space Invaders game, where the player is a floating pawn and can only move left and right. I need to be able to do this in blue print, but i’m struggling to find much material on this on line. Any help massively appreciated.
I think the easiest way to do this would be to just add invisible colliders to the walls.
Hey @DaveB3346!
@rokenrock is right! Just use 4 box colliders in your level that block pawn movement, and make a box out of them! That’s by far the easiest method, don’t worry about a clamp!
thanks guys very much for your help, it does have to be a clamp though in this instance (its part of
the project brief, to have a working screen clamp)
Collision is, for all intents an purposes, a clamp. There’s one (possibly two) clamp per collision face. I’m pretty confident your professor won’t mind the difference.
Without using collision, it’s bound to look janky. If you’re using set actor location for movement, you can just use the mathematical clamp node before setting. Excluding that and collision, any other method would be jittery.
Did you ever figure this out? I love how you got a bunch of non-answers.
The answer is to use collision. Don’t reinvent the wheel.
Either way, a clamp is the main component of this question and was mentioned.
If you need more specifics:
use a combination of the clamp, ConvertWorldLocationToScreenLocation, and GameUserSettings->Resolution nodes.
the answer was to clamp the distance the player can go from a set vector in the middle of the gamespace. no collision at all or screen location node.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.