World of Warcraft Camera

I been working on this online game, and I been trying to make my camera work like the one in world of warcraft, I know a little bit of code. like how to make the camera follow the player, but only thing I’m not sure about is when you hold right click to spin the camera around your character.

Plz help.

1 Answer

1

You best create an empty gameObject, and make the camera a child of it. Then you make the empty GO a child of the player, and set the local position to 0,0,0 (so it sits exactly where the player object is).

Then you move and rotate the camera the way you want (probably to the back, looking at the player, and rotating it slightly downwards).

Now, everytime you want to rotate or move the camera, you can jsut move and rotate the empty GO instead and the camera will always stay in the right position and rotation (relative to it’s parent, of course).

If you want to rotate the camera around the player when a button is pressed, you would check for it in the Update() function and then rotate the empty GO accoding to the relevant mouse axis (horizontal, I guess).

Check the Unity API for further information.

thank you.