- Home /
can I change float to vector3 on euler ??
so this my script :
float mouseX = lookAxis.x;
float mouseY = -lookAxis.y;
rotY += mouseX * mouseSensitivity * Time.deltaTime;
rotX += mouseY * mouseSensitivity * Time.deltaTime;
rotX = Mathf.Clamp(rotX, -clampAngle, clampAngle);
if (axes == rotationAxes.YandX)
{
Quaternion localRotation = Quaternion.Euler(rotX, rotY, 0) ;
mainCamera.transform.rotation = localRotation;
}
this is script to rotate camera, so i want use vector3 for my script, but i wont work. this can only work on float, i want use vector3 because sometime i want lo look another object position, but if the float can't lookat the object
Comment
Answer by StretchyPizza67 · Dec 01, 2018 at 10:44 PM
You could use the x, y, and z properties of a vector3 in the place of floats
Vector3 vec3;
Quaternion localRotation = Quaternion.Euler(vec3.x, vec3.y, vec3.z) ;
mainCamera.transform.rotation = localRotation;