Hello. I am attempting to use a script tin order to make the blade on my Helicopter spin 360* with a modifiable speed var.
I have done quite a bit of searching but i can only get info on spinning and rotating AROUND the origin point such as this for example:
using System;
using UnityEngine;
[AddComponentMenu("Scripts/Quests/SpinningSymbol")]
public class SpinningSymbol : MonoBehaviour
{
private void Update()
{
transform.Rotate(Vector3.forward * Time.deltaTime * 100);
}
}
If possible, can i get some assistance with this. Thank you.
What exactly is the issue?
I need the helicopter bade to spin in place using script.
And what is wrong with your code? It should rotate the object it is attached to.
I need it to spin like a helicopter blade, not move outwards around in a circle
What do you mean, move outwards in a circle? Can you describe what is happening? Also, be aware, you are using the forward vector, perhaps up, would be better.
Edit.
Also, make sure, if you have a child which is the art, to the transform you are rotating, make sure the child is at local position, Vector3.zero.
Not working.
Is there a better method to animate a mesh to simply spin in place?
EDIT
I found a way. i simply change the code line to this:
transform.Rotate(Vector3.down * Time.deltaTime * 100);
and attached the blade to a parent object to act as a roter
thanks for your input