Question by
Lukas-Ch · Jan 04, 2016 at 09:42 AM ·
scripting problemscriptingbasics
Acceleration issue
Hello, I have made script that should rotate my platform around x and z axis when i tilt my phone, but nothing hapends, compiler also shows no issues, can anybody explain me what i did wrong ?
pragma strict
var rb: Rigidbody; var torque: float; var smooth = 2.0; var tiltAngle = 30.0;
function Start () { rb = GetComponent.(); }
function Update () {
var target = Quaternion.Euler (Input.acceleration.x, 0.0f,-Input.acceleration.z);
rb.transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * smooth);//rotation of a platform around axis
}
Comment
Your answer
Follow this Question
Related Questions
How to set a special prefab in a switch? 1 Answer
Rotate character 0 Answers
How do i fix this problem 1 Answer
Help with a C# script .SetActive 1 Answer
How to add animations to character ? 0 Answers