click on object then zoom in
I am totally new here. What I want to do is write a #c code to make sure following steps
I have three object in the screen. What I want to do is 1. after click on one of the object, 2. other two disappear, 3. the one I choose leave alone. 4. And I can play around with it(zoom in; roast).
here is the code I have for roast using UnityEngine; using System.Collections;
public class movingbook : MonoBehaviour {
public float speed = 0.8f;
public float zoomMax = 1.5f;
public float zoomMin = 1f;
public float yMax = 5f;
public float yMin = 2.5f;
public float zMax = 1f;
public float zMin = -7.5f; //various speeds that affect how fast the heart rotates and moves
Camera camera;
void Start() //when the game starts
{
camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); //calls onh the main camera to be used later
}
void FixedUpdate() //calls every fixed number of frames (not specified here)
{
float inputX = Input.GetAxis("Mouse X") * speed; //calls the mouse moving left and right
float inputY = Input.GetAxis("Mouse Y") * speed; //calls the mouse moving up and down
float zoom = Input.GetAxis("Mouse ScrollWheel"); //calls the mouse scroll wheel
if (Input.GetMouseButton(0)) //if left click is pushed.
{
transform.Translate(0, inputY, -inputX, Space.World);
Vector3 pos = transform.position;
pos.y = Mathf.Clamp(pos.y, yMin, yMax);
pos.z = Mathf.Clamp(pos.z, zMin, zMax);
transform.position = pos;
}
if (Input.GetMouseButton(1))
{
transform.Rotate(0, -inputX, -inputY, Space.World); //rotate the heart according to how the user moves his mouse with the mouse button pressed.
}
if (Input.GetAxis("Mouse ScrollWheel") != 0) //if the scroll wheen is cycled up or down
{
float camFOV = camera.fieldOfView;
camFOV -= zoom;
camFOV = Mathf.Clamp(camFOV, zoomMax, zoomMin);
camera.fieldOfView = camFOV;
}
}
} What I need to add for select and zoom in?
Your answer
Follow this Question
Related Questions
Help a tired man with #C..... (Record Player in Horror Game) 1 Answer
When targeting it doesn't change the different mobs health 0 Answers
How to get a script to check an area of the game screen and not just one finite point? 1 Answer
snaping side by side 0 Answers
MANUAL CHANGE of ANIMATION RANGE on multiple objects 0 Answers