- Home /
parenting a camera with a sphere
i paired a camera with a sphere so the camera would follow the sphere, but when i play it the camera rotates with the sphere. how do i make it just follow?
you could make them separate objects again, add a SmoothFollow camera control script, or make your own script to say in the Update function: transform.position = Vector3(PlayerObject.position.x,PlayerObject.position.y,(PlayerObject.position.z + 5)) don't forget to make a var PlayerObject : Transform; and then attach that javascript to your camera.
i guess i was just in a hurry... and didn't recognize that what i gave was an actual answer. regarless, it's an answer now!
Answer by SarperS · Dec 22, 2010 at 08:23 PM
Create a new Javascript, add it to the camera, set it's target as your sphere and tweak the offset coordinates to determine the offset.
> var target : Transform; var offset :
> Vector3;
>
> function LateUpdate(){
> transform.position = target.position + offset; }
Answer by dissidently · Dec 21, 2010 at 07:38 PM
Connect the camera to the sphere with a Configurable.Joint and make sure it's X,Y and Z rotation is set to FREE. If you're using physics, which you probably are with a sphere, the camera might affect your physics a little... if so, create an empty game object and attach that to the sphere with the joint and free rotation, then nest the camera to the empty object.
Answer by Jesus_Freak · Dec 22, 2010 at 06:19 PM
you could make them separate objects again, add a SmoothFollow camera control script, or make your own script to say in the Update function:
transform.position = Vector3(PlayerObject.position.x,PlayerObjcect.position.y,(PlayerObject.position.z + 5))
don't forget to make a var PlayerObject : Transform; and then attach that javascript to your camera
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Orthographic camera scale Problems? 0 Answers
Let camera render the scene just one time 1 Answer
how can i moving from camera to other using a code? 1 Answer