#Animation rotating
1 messages · Page 1 of 1 (latest)
Yep
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
So, the script here, it's attached to the sword prefab right?
Take your time. I appreciate any help
And the line that does the rotation is the transform.eulerAngles one, right?
yes
Okay, so, what's happening is that you're still trying to move the sword itself
You wanna move it's parent
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
yeah that works too
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
sorry for the late reply. Thank you. looking promising so far 🙂

May i ask you a question? I've got 1 issue I cand a work around
Sorry just now saw this message
Did you figure it out or ya still need help.
I did kind off :p Thank you
Anytime, if you need help be sure to ping me lol, unless I hear a ding I may not check here