x


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, 2012 at 01:00 AM

c4nert gravatar image

c4nert
1 1 4 5

(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, 2012 at 01:12 AM

DaveA gravatar image

DaveA
33.4k 417 336 443

(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

By RSS:

Answers

Answers and Comments

Topics:

x266

asked: Feb 29, 2012 at 01:00 AM

Seen: 1673 times

Last Updated: Feb 29, 2012 at 01:12 AM