Hello. This is the code I am using to spawn some things. How can I make it so that after the objects are spawned, they travel in a certain direction at a constant speed?
var source = objs[(Random.Range(0, 2))];
var position = new Vector3(Random.Range(481.5735, 559.3441),
Instantiate(source, position, Quaternion.identity);
Given that your objects in your array objs all have a rigid body;
Rigidbody clone = Instantiate(source, position, Quaternion.identity) as Rigidbody;
Debug.LogWarning("Clone already have constantForce.", clone);
clone.constantForce.force = new Vector3(0, 10, 0); // upward force!
Debug.LogWarning("Have no rigid body. No force added.", this);
I have a similar problem but I'd like to add a force that launches the projectile at an angle rather than straight up, down, left, right, forward, back. So something like 30* off of straight ahead z.
Maybe at the local coordinate level if possible.