playMaker

Author Topic: Constraining/Clamping/Restricting player movement.  (Read 1372 times)

Red

  • Hero Member
  • *****
  • Posts: 563
    • View Profile
Constraining/Clamping/Restricting player movement.
« on: March 21, 2015, 01:13:14 PM »
Hello again... I'm trying to figure out an elegant system to see about limiting the player object's movement for a shmup that limits the player from moving outside of the boundaries of the screen.

I've got the data to feed it (where the boundaries of the screen are relative to the player's location in the scene) but I'm coming up against a wall on how to do this as elegantly as possible (without layering on too many FSMs on top of it.)

I'd like to avoid using rigid bodies if at all possible (box colliders at the borders of the screen that are set to prevent the player from moving outside of it.)

Anyone ever crack this one?

sebaslive

  • Hero Member
  • *****
  • Posts: 565
    • View Profile
    • Frame Tale Studios
Re: Constraining/Clamping/Restricting player movement.
« Reply #1 on: March 21, 2015, 04:49:54 PM »
Hey Red,

I hope this doesn't sound too trivial but if I understand correctly a very simple way that I actually took from one of Jeans projects is to use the top and bottom data with a float compare for the top and another float compare for the bottom and set two events for top and bottom and when it is equal to that position you go to a new state that has the action Set Position to your top bound data with a next frame event going to the start state and your second state being the bottom bound state with the set position to your bottom bound data and the next frame event.
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez