playMaker

Author Topic: 2D Camera  (Read 3817 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
2D Camera
« on: April 03, 2015, 06:15:06 PM »
Hi!

I try to make a 2D camera for a 2D space shooter like this:

https://www.youtube.com/watch?v=t9Qm6d9oS40

I can make the camera follow the player, but as you can see in the video, when the ship moves to the right, the ship smoothly moves to the left. And if the ship moves to the left, the ship smoothly moves to the right. How can I do that? Any ideas?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: 2D Camera
« Reply #1 on: April 03, 2015, 06:18:20 PM »
Check this video instead. It looks like the other video only moves the the right. :)

https://www.youtube.com/watch?v=nxPoXjSgNFo
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: 2D Camera
« Reply #2 on: April 03, 2015, 06:39:44 PM »
This is a bit complex to detail in one post so I to lead you in the right direction what you want to do is have the camera get the X on the players position and add +[num] to that X and set the position of the camera to that X to get it positioned in the middle.

The smooth switch from left to right can be down with a Smooth Lerp action so that when it moves over to the other side the camera lerps to that new position. So, study lerps and the action advanced lerp because that is the key to getting these smooth positions.

GLHF!
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

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: 2D Camera
« Reply #3 on: April 03, 2015, 07:46:23 PM »
The only Lerp action I have is Vector3 Lerp. Is it this one I should use.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: 2D Camera
« Reply #4 on: April 03, 2015, 07:51:05 PM »
I found "Float Lerp Advanced" on the Ecosystem. Maybe it's this one.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no