- Home /
Camera changes position when click on 3D text
Here is what i have. I have a main menu that looks like this
So i want when i click on the text "OPTIONS" the camera to move over to the table. I have already made the animation and here are the scripts i use.
function OnMouseUp() { transform.animation.Play("Camera"); }
i use this code in the 3d text but it changes the position of the text not the camera's. I think i have to put a reference to the Main camera on the 3d text script. Anyone can help ?
Answer by Stormizin · May 30, 2013 at 05:03 PM
You just can use this:
public void CameraMove(){
if(Input.getKey(1)){
Camera.maincamera.transform.Translate(Vector3.foward);
}
}
The ideia is: You can just use translate every click to go foward into table and back to the original position.
No it doesn't work. I think you didn't get what i want to do. I have the animation where the movement is from the spot we are to over the table i need to make the animation play on the camera not the 3d text. When i hit click on the "Options" the 3d text plays the animation ins$$anonymous$$d of the camera. If it helps this the script i have in the 3d text function On$$anonymous$$ouseEnter() { //Change the color of the text renderer.material.color = Color.red; }
function On$$anonymous$$ouseExit() { //Change the color of the text renderer.material.color = Color.white; }
Answer by t0n1s · May 30, 2013 at 08:10 PM
Oh nevermind, i added a box collider in the main camera moved it in the position of the 3d text and used the codes
function OnMouseUp()
{
animation.Play("Camera");
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613103221im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Playing different button animation after first animation plays 1 Answer
How to play sprites animation on the place that we click? 0 Answers
How To Play Animation On UI Button Click Please... Im Going To Freak Out Please Enter And Help Me 2 Answers
UNITY 2D: How to make a level selection menu (like the video in details)? 1 Answer
How can I stop an animator playing 0 Answers