How to zoom?

Hello, I have 2 game objects in diffrent positions and I duplucated the first object in the same positions..Now I have three Objects. How can I change the 3.object's position in the direction between the first 2 objects?

I tried to use Vector3.Distance but I couldn't find the way :(

My purpose is to be able to control the camera in horizontal way for zoom..

more ▼

asked Feb 29 '12 at 01:00 AM

c4nert gravatar image

1 1 2 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

'Zoom' is a term used generally with the Camera's FOV (field of view). If I understand you, you want to turn object 3 to LookAt the point between object 1 and object 2, is that correct? If so, add object 1's position to object 2's position and divide by 2. That gives the mid-point on a line between 1 and 2. Then use Transform.LookAt at that point. If you want to transition to that point, use a Slerp function. Examples are in the docs.

more ▼

answered Feb 29 '12 at 01:12 AM

DaveA gravatar image

32.4k 158 176 278

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Feb 29 '12 at 01:00 AM

Seen: 1407 times

Last Updated: Feb 29 '12 at 01:12 AM