x


Camera move belong a certain path

i want to control the camera to look around a certain object(which stable in the middle it wont move )in different direction for example my mouse move to right hand side the camera will surround the object clockwise.

thank for answering my question

more ▼

asked Apr 05 '12 at 07:45 AM

papamck gravatar image

papamck
14 3 4 4

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

1 answer: sort voted first

As with your other question about the mouse-over event, your english unfortunately makes it hard to understand fully what it is you want to do..

For the sake of an answer to one possible question: If what you want is to rotate your camera around an object like it's "orbiting" around it, you could start by getting your camera to always look at the object. You can do that pretty simple with the Transform.LookAt() function.

The part about if the mouse is on the right hand side of the screen you could use Input.mousePosition. A simple script for this would be something like this:

using UnityEngine;
using System.Collections;

public class mousePosition : MonoBehaviour {

    private Vector3 position;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

       position = Input.mousePosition;

       if (position[0] <= Screen.width/2){
         print("Left side..");
       }

       else if (position[0] >= Screen.width/2) {
         print("Right side..");
       }
    }  
}

All you have to do with the script is to add the rotation that you want around your object..

more ▼

answered Apr 05 '12 at 10:40 AM

PetterDK gravatar image

PetterDK
138 2 7 11

thank you I will work on it sorry for my poor english

Apr 05 '12 at 11:12 AM papamck

Don't be sorry, it was just to tell you that my answer may not have been what you were looking for :) Please spread karma by upvoting.. Hope you solve your programming problems.

Apr 05 '12 at 01:28 PM PetterDK
(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:

x3012
x725
x499
x20
x6

asked: Apr 05 '12 at 07:45 AM

Seen: 646 times

Last Updated: Apr 05 '12 at 01:28 PM