Hello!
I’m building a cube for a first person to walk inside.
When you get to a face of the cube, inside of it, the cube will roll in that face direction, so the first person will walk on the wall.
So I have a trigger near to each cube edge, and:
//function to deal with the cube rotation
function OnTriggerEnter () {
rotateCube();
rotateCamera();
}
//cube rotation
function rotateCube(){
Ani.Mate.To(cubo, 2, {"rotation": Quaternion.Euler(nowRotX + rotationX, nowRotY + rotationY, nowRotZ + rotationZ), "drive": SlerpDrive});
}
//camera rotation
function rotateCamera(){
cameraHandler = myCamera.GetComponent(MouseLook);
cameraHandler.originalRotation.x = -1;
Ani.Mate.To(myCamera.transform.localRotation, 2, {"x": -1});
}
myCamera is using MouseLook Script. So, to change camera rotation, when I’m on the wall, I need to access its originalRotation properties.
I’m trying to animate this preperties changing so it could be a more soft trasition, but Ani.Mate isn’t working here!
I’ve placed before both ways that I’m using to change originalRotation.x, for example so you could see what I’m trying to:
cameraHandler.originalRotation.x = -1;
Ani.Mate.To(myCamera.transform.localRotation, 2, {"x": -1});
Any idea why Ani.Mate isn’t working?
or
Can I use any other way to change originalRotation.x from 0 to -1, for example, but having animation on it?
The cube rotation is working properly!
Thanks in advance!!