How to rotate a object against another

Hi, I am making a explosion for my grenade and I want the explosion texture to rotate against the player, and I’ve already accomplished this, but the thing is that it stays rotated downwards, I mean that I have rotated it to stand up but when the rotation sequence begins it gets forced to the ground. How do I fix this?

Here’s my rotation script:

var Other : Transform;

function Start () {

}

function Update () {

  transform.localRotation = Other.localRotation;


}

I think what your doing here is assigning the “Other’s” local rotation to your transform’s rotation.

I don’t know if the transform is the grenade or the character, so I’m presuming the transform is the character and the grenade texture.

You should try transform.rotation, instead of localrotation, local rotation is used for rotating child objects. Unity’s parent object over-rides rotation for its children, to change a over-ridden property, local-rotation will be used. Something like, when you want an object to rotate on its own axis vs the parents axis.

Also, transform.rotation or localrotation is a Quaternion value, not actual angles (degrees). The values are from 0-1, if you are looking for degree’s, try transform.eulerangles

Have a look at this:
Link to UnityScript reference of Transform

See the usage of transform.euler and localangles, applying another object’s rotation on a Quaternion level will cause
weird snapping and inversions, which is what’s happening in your case.

Hope it helps.