- Home /
iTween Rotate and Look at the Object.
I'm a noob is using Unity iTween.
I would like to make the camera keep rotating and look at an object. How's the code?
Thanks.
Answer by pixelplacement · Jan 12, 2011 at 08:01 PM
Or you could use iTween's LookUpdate() which would introduce easing and has more options available ():
var LookAtTarget : Transform;
function Update ()
{
LookUpdate(gameObject, LookAtTarget.position, 2);
}
You can learn more from the documentation.
Answer by AtomicMarine · Jan 12, 2011 at 10:24 AM
Would you like the camera to keep rotating? if so in wat direction?
and to make the camera face an object you would use this code
var camera : Tranform; //select your camera for this one
var object : Transform;
camera.LookAt(object);
Answer by FLASHDENMARK · Jan 12, 2011 at 12:18 PM
var LookAtTarget : Transform;
function Update ()
{
transform.LookAt(LookAtTarget);
}
This should work. :)
Answer by felix85 1 · Jan 13, 2011 at 03:40 AM
I would like to make the camera rotate in round shape while it keep looking at the gameObject.
Please help. Thanks.
Answer by felix85 1 · Jan 13, 2011 at 04:15 AM
I have used
var rotation = Quaternion.Euler(40, velocity, 0);
var position = rotation * Vector3(0, 0.8, -6.8)+target.position;
transform.rotation = rotation;
transform.position = position;
but it is pain because when I start to run the game, the camera is "stuttered" at the beginning and runs smooth after that, so I'm trying to use iTween to solve this problem.
Any suggestion?
Your answer
Follow this Question
Related Questions
How to allow movement during camera shake? (iTween) 0 Answers
RTS Camera Rotation and Movement 0 Answers
Camera movement question 1 Answer
Move camera forward/backwards with mouse wheel 1 Answer
iTween MoveTo Function is Jumpy 3 Answers