This is my first question here. I'm a beginner programmer, just been thrown into it at work. Im actually just a 3D modeller, but anyway.
I've got a situation where I have set up a camera with a look at script that moves and changes depending on which object the user presses. Works fine but now i have been asked to make it so you can look around once from that camera point.
This is what i have tried, script is applied to the camera.
rotation = Quaternion.LookRotation(lookAt.transform.position - transform.position);
if(lookAtOn==true){
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
}
if(transform.rotation==rotation){
lookAtOn=false; tVCamCentred=true;
} else{
tVCamCentred=false;
}
Then i just have pretty much on click on the screen to reset the camera, lookAtOn=true
This works perfect when it wants to. every so often it just gets stuck with lookAtOn=true
and won't turn off, have to close the app and restart.
↧