- Home /
Is there any way to transition from third person to sidescroller?
Hello! My problem seems really simple, and yet I can't figure out how to accomplish this!
The red star is my enemy, with the circle being his territory, If the green star enters the large red circle, a variable "Battle" is set to true. The green star is the player who can move forward and back and turn left and right, he is followed by the camera (blue) which is controlled by a standard smooth follow script when battle = false.
Upon the battle variable going true, the camera focuses on a dummy object childed to the enemy, which stays exactly halfway between the enemy and player. this is where i run into my issue. The two characters can now only jump and move towards or away from each other, essentially transitioning from a 3rd person rpg to a street fighter style combat system. I want the camera to remain normal to the vector between the two characters, and on the same side. But it seems to not stay normal, and when the characters turn around, the camera changes the side of the battle it's on. Also, the left and right buttons don't work the way I'd like. When you press right you want your character to go right, and left when you press left, but the right button always move the player closer to the enemy, and the left button away from him. Sorry for the long question, I can provide my code if you like, Thank you in advance!
Answer by Kiloblargh · Jul 02, 2013 at 05:17 AM
Upon the battle variable going true, the camera focuses on a dummy object childed to the enemy, which stays exactly halfway between the enemy and player. this is where i run into my issue.
Don't child it to the enemy. Just set its world position to a point between the enemy and player in Update. Have it look at the enemy, then have another dummy object a child of that, at 90º (on its +x local axis) . Adjust the local position of dummy 2 relative the distance from the player to the enemy. You can have the camera rig move from its original position to dummy2's position with SmoothToward so you get a visual swoop-down transition.
I think I actually have a solution: use a custom function to set the value of a vector from the player to the enemy (or from the enemy to the player), delete the Y component, multiply it by 3 or 4, and don't continue to update it. This will create a point for the Player object to move towards and away from that is well outside of the combat field. Then, don't rotate parent objects, rotate the children. This means the player and enemy objects will continue to face the same direction but the meshes will rotate to face each other.
Your answer
Follow this Question
Related Questions
2d camera scrolling 0 Answers
Issue with my camera controls 0 Answers
Camera Viewport Height - Horizontal Transition 0 Answers
Movement object same distance as touch movement 0 Answers
Transition a camera from ortographic to perspective mode (Trombone effect) 2 Answers