- Home /
acceleration and eulerAngle problem
I am working on SpaceShooter like game.
I have called two functions in Update() method.
1) ApplyAcceleration() 2) SetRotation().
in ApplyAcceleration() method, I am setting acceleration data on X axis. like
Vector3 dir = Vector3.zero;
dir.x = Input.acceleration.x;
dir *= Time.deltaTime;
transform.Translate(dir * speed);
In SetRotation(). method, I am setting EulerAngle of playerShip like
float x = transform.position.x;
float z_rotation = Mathf.Abs(x * 5f);
if (x >= 0)
z_rotation = -z_rotation;
Vector3 rotation = transform.eulerAngles;
rotation.z = z_rotation;
transform.eulerAngles = rotation;
but don't know, when I am calling SetRotation() method, Playership waits for sometimes and then it go ahead, i mean Playership not moving smoothly.
can't i use acceleration and EulerAngles simultenuously or what?
yes you can use both acceleration and EulerAngles simultaneously...
Your answer
Follow this Question
Related Questions
Relative Rotation of GameObject 3 Answers
how to tilt boat on turning 2 Answers
What is transform.Rotate doing internally when going beyond 360° or 0°? 0 Answers
Instant Transform.Rotate? 1 Answer
Object instantiate, Projectile problems 2 Answers