playMaker
Home
Store
Showcase
Tutorials
Forums
Manual
Wiki
About Us
Playmaker Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Join our
Discord Channel
Home
Help
Search
Login
Register
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
(Moderator:
600
) »
Camera following the player
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Camera following the player (Read 9645 times)
Rabagast
Hero Member
Posts: 683
Camera following the player
«
on:
January 15, 2014, 09:29:08 AM »
Hi!
I have a FSM on the camera with the action "Smooth Follow Action"
But I only want the camera to follow horizontal not vertical. When I jump, the camera is following the player vertical. Is is possible to freeze the Y-axis on the camera or something?
Logged
Check out our homepage.
http://www.walsberg.no
Or my personal game blog for news about my games.
http://retro-tetro.walsberg.no
phannDOTde
Full Member
Posts: 237
Re: Camera following the player
«
Reply #1 on:
January 15, 2014, 09:56:08 AM »
Did you try to just overwrite the Y Pos every Frame with Set Position XYZ just setting the Y Value?
Logged
redikann
Full Member
Posts: 174
Re: Camera following the player
«
Reply #2 on:
January 16, 2014, 12:19:47 AM »
I actually like the "Move Towards' action. I've had success just looping it into itself for a good camera follow.
Logged
Rabagast
Hero Member
Posts: 683
Re: Camera following the player
«
Reply #3 on:
January 16, 2014, 01:34:52 AM »
redikann:
But how can I stop the Y-axis with "Move Towards action"?
Do I place it on the camera in the same state as "Smooth Follow action"?
I think I need a little bit more specific help.
Logged
Check out our homepage.
http://www.walsberg.no
Or my personal game blog for news about my games.
http://retro-tetro.walsberg.no
redikann
Full Member
Posts: 174
Re: Camera following the player
«
Reply #4 on:
January 16, 2014, 01:37:50 AM »
It has an option to ignore vertical movement(y axis)
Logged
redikann
Full Member
Posts: 174
Re: Camera following the player
«
Reply #5 on:
January 16, 2014, 01:41:05 AM »
I use it to replace smooth follow. Just add a Finished event and loop it back into itself. But do not set the finish event for the Move towards action.
Logged
Rabagast
Hero Member
Posts: 683
Re: Camera following the player
«
Reply #6 on:
January 16, 2014, 01:48:35 AM »
But now the camera is just moving towards the player until the player is disappearing. This is a 2D platform game.
Logged
Check out our homepage.
http://www.walsberg.no
Or my personal game blog for news about my games.
http://retro-tetro.walsberg.no
redikann
Full Member
Posts: 174
Re: Camera following the player
«
Reply #7 on:
January 16, 2014, 01:54:47 AM »
Hehe well yes that's a problem there. You can set an offset so the camera is limited on any axis.
Logged
redikann
Full Member
Posts: 174
Re: Camera following the player
«
Reply #8 on:
January 16, 2014, 01:57:20 AM »
If you set a target game object then set a target position that position becomes an offset. I do not know the axis you are viewing from but I bet you can mess around and figure it out. The action will assume that Y is your up axis.
Logged
Rabagast
Hero Member
Posts: 683
Re: Camera following the player
«
Reply #9 on:
January 16, 2014, 12:14:34 PM »
How can I set an object to an offset then?
The problem is now, when I'm walking to the left, the camera is ok, but when I turn to the right, the camera just fly through the player.
Logged
Check out our homepage.
http://www.walsberg.no
Or my personal game blog for news about my games.
http://retro-tetro.walsberg.no
redikann
Full Member
Posts: 174
Re: Camera following the player
«
Reply #10 on:
January 16, 2014, 12:23:02 PM »
I apologize for leaving out something important to my set up. I parent my camera to an empty and I place that empty at the players origin. I do not parent the empty to the player but just place it at the same local space. You can move the camera wherever you want to in the scene because the logic will be run by the parent. It works great for my 3rd person cam but I haven't worked with it in 2d. Seems like it should work.
Logged
Rabagast
Hero Member
Posts: 683
Re: Camera following the player
«
Reply #11 on:
January 17, 2014, 08:38:30 AM »
Ok! Just see if I have understood correctly. I make an Empty GameObject and place it as a child to the player. On the camera, I create a FSM with these actions:
-Move Towards
-Set Parent.
On Set Parent, I use the empty GameObject.
Am I in the right way?
But I know something is wrong here, because it doesn't work.
Logged
Check out our homepage.
http://www.walsberg.no
Or my personal game blog for news about my games.
http://retro-tetro.walsberg.no
redikann
Full Member
Posts: 174
Re: Camera following the player
«
Reply #12 on:
January 17, 2014, 10:09:43 AM »
:)Alright I am gonna walk you thru this again Sir.
1. Parent your camera to an empty gameobject.
2. Place your gameobject(camera Parent) at the origin of your player.
Do not parent the gameobject to the player.
3. Place all playmaker logic for the camera movement on the parent gameobject.
So place a "Move to" action on the gameobject(camera parent) that will
move to the player.
You can see that I loop back into it with a finished event. I do not call the Finish event from a FSM action. It will automatically loop itself when ready ( granted you do not use an action that loops every frame). I find this to be a better solution than smooth follow for a 3rd person set up.
Also because your camera is parented to another object that moves it, in the editor you can move your camera around until you find the correct viewing angle/distance and that should give you your camera offset. Move towards gives you the option to ignore vertical and the speed slider should be enough that your camera never lags if you need that.
«
Last Edit: January 17, 2014, 10:17:55 AM by redikann
»
Logged
Rabagast
Hero Member
Posts: 683
Re: Camera following the player
«
Reply #13 on:
January 17, 2014, 03:47:25 PM »
Is it iTween Move To you mean I should use? And this I'm placing it in State 1?
And is it other Actions I need in state 1?
Logged
Check out our homepage.
http://www.walsberg.no
Or my personal game blog for news about my games.
http://retro-tetro.walsberg.no
Print
Pages: [
1
]
Go Up
« previous
next »
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
(Moderator:
600
) »
Camera following the player