Camera isn't move position? Why my camera isn't change position?
I have a question, i make a parkour game and my hero must run on the top but I must move camer down, but it isn't. Can someone help me?
Quaternion targetAngle_180 = Quaternion.Euler(0, 0, 180);
Quaternion targetAngle_0 = Quaternion.Euler(0, 0, 0);
public Quaternion currentAngle;
public GameObject player;
public bool isGr;
public GameObject cam;
public bool isDone = true;
public Rigidbody Rigid;
void Start()
{
currentAngle = targetAngle_0;
}
public void Update()
{
if (isGr == true)
{
ChangeCurrentAngle180();
if(isDone == true)
{
cam.transform.position = new Vector3(0, 100, 0);
isDone = false;
}
}
if (isGr == false)
{
ChangeCurrentAngle0();
}
player.transform.rotation = Quaternion.Slerp(player.transform.rotation, currentAngle, 0.2f);
}
void ChangeCurrentAngle180()
{
if(currentAngle.eulerAngles.z == targetAngle_0.eulerAngles.z)
{
currentAngle = targetAngle_180;
}
}
void ChangeCurrentAngle0()
{
if (currentAngle.eulerAngles.z == targetAngle_180.eulerAngles.z)
{
currentAngle = targetAngle_180;
}
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Player"))
Rigid.mass = 4; // This can be changed to whatever you want, this is if you want the mass changed;
Rigid.useGravity = false; // This is if you want to turn the gravity off;
isGr = true;
}
void OnTriggerExit(Collider other)
{
Rigid.mass = 1; // Back to normal here using mass;
Rigid.useGravity = true; // This is if you want the gravity to be turned back on;
isGr = false;
}
}
ss.png
(197.3 kB)
Comment
Your answer
Follow this Question
Related Questions
Resetting Camera Position 1 Answer
How to get the position of the Main Camera 0 Answers
my camera is rotating on Z axis when i just set it on X and Y 0 Answers
How to change camera on Android? 1 Answer