EDIT: Hi Guys! I’m new here, but I’m trying to do something I think is really simple, but can’t get it for the life of me. I’m trying to “launch” cows across the screen as if there is a hurricane blowing them in the wind (complete with Quaternion). I got them to instantiate perfectly, transform.Translate isn’t working the way I need. Please see my code below:
using UnityEngine;
using System.Collections;
public class CowLauncher : MonoBehaviour
{
public float delay = 0.1f;
public GameObject cow;
public Vector2 launchSpeed;
public int cowSpeed;
private bool spawnedTrue;
void Start ()
{
InvokeRepeating("Spawn", delay, delay);
spawnedTrue = false;
}
void Spawn ()
{
Instantiate(cow, new Vector2(3.59f, Random.Range(-0.5f, 1)), Quaternion.identity);
spawnedTrue = true;
}
void FixedUpdate ()
{
if (spawnedTrue)
{
transform.Translate(cowSpeed * Time.deltaTime, 0f, 0f);
}
}
}
This just causes my empty game object that it’s attached to to move, and not the cows Also, it doesn’t make the cows spin? It doesn’t spin with the Quaternion.identity because it’s 2D? Any help would be greatly appreciated!