Mina Fawzy
Mina Fawzy

Reputation: 21452

Rotate cloned object 90 degrees

I create object +10 sign when player shot enemy

I need to rotate this sign 90 degrees from enemy object

I use code below , but it still not working

private void plus_score(){
    Quaternion spawnRotation = Quaternion.Euler (0, 0, 90);
    Instantiate( Score_object ,gameObject.transform.position ,spawnRotation);
}

any suggestion to rotate my clone object

Upvotes: 0

Views: 198

Answers (1)

maraaaaaaaa
maraaaaaaaa

Reputation: 8173

I need to rotate this sign 90 degree from enemy object

You multiply Quaternions together to rotate them.

private void plus_score(){
    Quaternion spawanRotation = enemy.transform.rotation * Quaternion.Euler (0, 0, 90);
    Instantiate( Score_object ,gameObject.transform.position ,spawanRotation);
}

Upvotes: 1

Related Questions