- Home /
Rotate a sphere in the same direction the camera is pointing at
This is my third attempt to ask a question.
I'm trying to make an object move always in the same direction the main camera is looking at. The problem is, I'm not really good at coding and don't get it at all. But I really want to understand this. So, I'm using the movement script from the "roll a ball" tutorial. It's working great and it's understandable.
Now I want to rotate the player in the direction the camera is looking at. But how do I do this? When I move the camera by the mouse, I would need to rotate the player (which is a sphere) too. But this way, the movement of the player would be interrupted, right?
Answer by contab009 · Aug 28, 2014 at 01:43 PM
Did you try this ?
player.transform.rotation = Camera.main.transform.rotation
Or just maybe cam, as a public assigned variable.
Answer by Lunas Lama · Aug 28, 2014 at 04:49 PM
I figured it out. I'll post my solution later this day :)
Your answer
Follow this Question
Related Questions
Attempting to make sphere travel in direction of camera 1 Answer
Move character in direction its facing 1 Answer
Camera/Direction Rotation 2 Answers
Rotating camera around the sphere 2 Answers