- Home /
Question by
dennis Volkerts · Mar 13, 2011 at 05:19 PM ·
collisiongameobjectshoothit
shooting and hit script JS
Hi im new to unity and i m making a little shooting game were you need to shoot some ducks on a fair.
when it hits the duck it should rotate -90 degrees.
so i inserted this script to my duck:
var bullet; function OnCollisionEnter (hit : Collision) { if(hit.gameObject.tag == bullet){ print ("test hit"); hit.gameObject.rotation.x = -90; } }
after addings this code it just dont work anyone??
thnx alot
Comment
Answer by loopyllama · Mar 13, 2011 at 05:31 PM
.rotation is a quaternion, yet you set it to an euler angle
try .Rotate() instead
here are the docs for more detaled information about the method Rotate() http://unity3d.com/support/documentation/ScriptReference/Transform.Rotate.html