- Home /
Question by
FoxMonster · Feb 24, 2014 at 01:44 PM ·
rotaterotatearound
Accelerometer RotateAround player
Hello, first of all sorry for my English. I have this script which rotates the scene, but I have trouble moving the player. I need the scene to move around the player, but it still fails, try to rotatearound, but I can not do it just fine, becomes unstable.
I searched but can not find anything like it on the forums.
var VeloocidadDeGiro : float ;
var MaximoGiro : float;
var RotacionMaxima : float ;
var Sensivilidad : float;
private var normalizedSpeed : float = 0.2;
private var euler : Vector3 = Vector3.zero;
var horizontalOrientation : boolean = true;
function FixedUpdate () {
var accelerator : Vector3 = Input.acceleration;
euler.z = Mathf.Lerp(euler.z, -accelerator.x * RotacionMaxima, 0.2);
euler.x = Mathf.Lerp(euler.x, accelerator.y * RotacionMaxima, 0.2);
var rota : Quaternion = Quaternion.Euler(euler);
transform.rotation = Quaternion.Lerp (transform.rotation, rota, Sensivilidad);
}
Comment
Your answer
Follow this Question
Related Questions
Flying player Rotates in the left and right direction not forward and back 1 Answer
Switch Vector3 direction 1 Answer
How to rotate the planar region to alway face the camera? 2 Answers
How do I rotate on a new pivot point with RotateAround? 2 Answers
Rotate around obsolete - missing Rotate overloads??? 2 Answers