- Home /
eulerAngles not set to zero.
Hello all,
I am generating a ball from canon like,
GameObject baseBallClone = (gameObject)Instantiate (baseBall, position, canon.transform.rotation);
On collsion of boundry I want to set baseBallClone's rotation as zero.
I did like,
baseBallclone.transform.eulerAngles = Vector3.zero;
it's not working.
I tried even baseBallclone.transform.rotation = Quaternion.identity;
even
baseBallclone.transform.rotate(Vector3.zero); not working..!!!
where I am mistaking...or something else..??
baseBallclone.transform.eulerAngles = Vector3.zero;
and
baseBallclone.transform.rotation = Quaternion.identity;
Should be working.
Are you able to show us more code? Perhaps you could show us the hierarchy of your scene?
Show us the script in its entirety. The lines you reference shouldn't even compile, since the GameObject's name is "baseBallClone", and your lines reference it as "baseBallclone", with a lower case c. So your actual script must be doing something different, if it compiles.
CHPedersen, Thank for your comment.
But there is no speeling mistake. because I am setting angle in boundry's collsionEnter2D method like,
other.transform.rotation = Quaternion.identity; even i tried, other.transform.eulerAngles = Vector3.zero;
That's probably because you define the CollisionEnter parameter as other : Collider, spelling does matter, and this most certainly looks like a mistake.
Answer by RedDevil · Sep 15, 2014 at 12:24 PM
Have you tryed BaseBallcones.transform.rotation = Vector3.zero; ?
I can't set rotation as vector3. because it's type is quaternion.