|
Hey UnityAnswers, I'm looking for some advice on some code I have. Basically I have 4 cubes, each being a different colour (Red, Blue, Green and Yellow). In the center is an empty gameObject, with the mainCamera parented. When the gameObject rotates, so does the mainCamera. Right now I have input controls to rotate the empty gameObject either left or right, showing each of the cubes. Here is what my scene looks like just for visualization : http://imgur.com/79ibA What I'm trying to get is a smooth curve between 90 degree intervals. I don't want it to change like a light switch. I'm not a good programmer, but I'm thinking it involves either for loops, time.Deltatime or transform.Rotate. Let know if you can help me out. The code I'm working on is below. or an older version:
(comments are locked)
|
|
Have a look at this: http://unity3d.com/support/documentation/ScriptReference/Mathf.MoveTowardsAngle.html You'll want to set a 'target rotation degrees' OnKeyDown, rather than using a for loop. Anything you do in one frame will all happen in that frame, so you need to spread it across frames. Time.deltaTime is your friend.
(comments are locked)
|
