Follow target on one axis only? #421
Unanswered
JamesLoyMartin
asked this question in
Question / Help Wanted
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First, I love Phantom Camera. Thanks for making it!
So is there a way to follow the follow_target along only one axis and not both x and y?
I'm trying to follow the player only along the x axis at certain times.
Specifically, I want the camera to 'platform snap', meaning the camera does not move on the Y axis when the character is jumping in the air, but only when he is on the ground. Used in Super Mario World and Donkey Kong Country 2 onwards.
Here is an example of how i achieved platform snapping with phantom camera so far:
you can see the camera follow_target at the top.
My solution was to have the phantom camera follow a different target (the triangle at the player's feet) when the player jumps, then switch the follow_target back to the player when he lands.
It looks nice in the GIF, but really there is a noticeable one frame pause when switching the follow_target back and forth as the other target following the player lags behind one physics frame. (I'm simply doing position.x = player.position.x in physics process for lack of a better way to follow the player, but it lags a frame.)
Ideally, I'd like to just always follow the player and disable following along the y axis instead of switching follow_target to avoid the lag. Is that possible or is there another approach you would recommend?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions