#Animation rotating

1 messages · Page 1 of 1 (latest)

agile storm
#

Hi. I'll send you everything I have about the sword in a sec

fickle pagoda
#

Yep

agile storm
#

Hi. i'm back

#

The Firepoint is there it spawns

#

This is the sword. As you mentioned. The Sword that spawns is attached the an empty game object. The animation is on the sword itself

#

This is my sword

#

using UnityEngine;

public class SwordAttack : MonoBehaviour
{
public GameObject wallHitParticlePrefab;

void Start()
{
    Destroy(gameObject, 0.4f);
    transform.eulerAngles = new Vector3(0, 0, GameObject.Find("Player").transform.eulerAngles.z);
}

void OnTriggerEnter2D(Collider2D target)
{
    if (target.tag == "Wall")
    {
        // Instantiate the wall hit particle effect at the collision point
        if (wallHitParticlePrefab != null)
        {
            Instantiate(wallHitParticlePrefab, transform.position, transform.rotation);
        }
        Destroy(gameObject);
    }
}

}

#

This is the sword script

#

So The sword is a prefab. I spawn it in whenever i want to do an attack (a clone) then it gets destroyed. Just like a bullet

#

It rotates with my player in the right direction but a ssoon as i have an animation. it only points up

#

I hope I have provided everything

fickle pagoda
#

Sorry I'm here

#

Was just distracted by stuff

#

Ahhh okay I see

fickle pagoda
agile storm
fickle pagoda
#

And the line that does the rotation is the transform.eulerAngles one, right?

agile storm
#

yes

fickle pagoda
#

Okay, so, what's happening is that you're still trying to move the sword itself

#

You wanna move it's parent

agile storm
#

I'm burnt out from this. Cant i put the rotation script onto the parent and take it from the sword?

#

fml. That semmed to have worked

#

jesus. the relief

#

Thank you

fickle pagoda
#

anytime, i had the same issue with you with enemies not rotating when i added animations to em

#

the friendly people here helped me fix the issue by telling me exactly what i told you

#

ezpz

#

what you could've also done is just make a reference to the parent

#

and call on its transform instead

#

either through serializeField or through finding it by name/tag

agile storm
#

I'll keep that in mine

#

Thank you.

fickle pagoda
#

anytime

#

i hope you game turns out to be a #1 Jam!

agile storm
fickle pagoda
agile storm
#

May i ask you a question? I've got 1 issue I cand a work around

fickle pagoda
#

Did you figure it out or ya still need help.

agile storm
#

I did kind off :p Thank you

fickle pagoda
#

Anytime, if you need help be sure to ping me lol, unless I hear a ding I may not check here