playMaker

Author Topic: Restricting Ship movement keep it within camera view  (Read 928 times)

Aslan

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Restricting Ship movement keep it within camera view
« on: June 24, 2014, 06:21:01 AM »
Hello, I'm building a shmup like game with a side view camera(world in 3D movement happens 2D).

I want to restrict the player's movement to be within the camera's view. I've tried setting up collisions around the camera view frustum, but the collision is broken through more often than not. To mitigate this, I tried to add a collision event, that runs "reset all axis" once, upon hitting the wall.

This works for movement alone, but interrupts allot of the other active mechanics that are playing out, such as weapons firing and item switching and so on.

I'm trying to find a way to use the "World to Screen Point" and/or "Screen To World Postion" actions to help me with this, but I can't quite figure out how to set it up correctly.

Here is a picture showing the current setup for movement http://gyazo.com/13fd53e89c50a1cd7039cb082658becb

Any suggestions of assistance in this matter would be greatly appreciated. Thanks

phannDOTde

  • Full Member
  • ***
  • Posts: 234
    • View Profile
    • Peter Hann .de
Re: Restricting Ship movement keep it within camera view
« Reply #1 on: June 25, 2014, 03:34:18 PM »
Are you translating the ship and camera through the scene or do you scroll the backdrop scene through? For my 2D ShMUp I just read the ships position every frame and clamped it to a value and set position again. If you move the Camera and ship through a static scene you could still do the same thing using the camera position and just calculate your maximal ships positions from there.

Hope this helps

Aslan

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Re: Restricting Ship movement keep it within camera view
« Reply #2 on: June 26, 2014, 06:10:54 AM »
Thank you, I fiddled around with clamping until it started working for me.  ;D