Question by
windmarble · Jun 23, 2017 at 08:16 PM ·
rotationtransformrigidbody2d
Rotating GameObject Does Not Rotate Child
I am rotating a gameobject that has a child game object with a particle effect on it.
It's a missile with engine exhaust.
I am rotating the parent game object but the particle effect child objects do not rotate:
The missile object has this script on it:
void FixedUpdate () {
Vector3 dir = targetObject.position - transform.position;
dir.Normalize();
float zAngle = Mathf.Atan2( dir.y, dir.x ) * Mathf.Rad2Deg - 90;
Quaternion desiredRotation = Quaternion.Euler( 0, 0, zAngle );
transform.rotation = Quaternion.RotateTowards( transform.rotation, desiredRotation, 10.0f * Time.deltaTime );
rigidBody.AddForce( transform.up * 10.0f, ForceMode2D.Force );
}
Anyone see what I am doing wrong?
Comment
Your answer
Follow this Question
Related Questions
rotate object2d the direction it is moving? 0 Answers
Whenever Disabling A Collider2d, It still exists in the game. 0 Answers
Instantiated object does not inherit rotation. 1 Answer
How to translate an object in an unknown angle ? 1 Answer
Make Prefab Rotate Depending on a different Game Object's Rotation. 0 Answers