Rigidbody Velocity in negative direction
Hi everyone,
I have a problem regarding an instantiated prefab. I spawn an object and get it to move, but it only moves upwards. I want it to move downwards. Here is the code:
void SpawnObject() { GameObject ob= Instantiate(Prefab) as GameObject; ob.transform.position = new Vector2(xSpawnPos, ySpwanPos); ob.GetComponent().velocity = new Vector3(0,shiftSpeed,0);
The Spawn-Function is called every 3 three seconds. I want the objects to move from the upperscreen straight down. With the above Code the object is moving up, which is the opposite direction. I tried just putting a "minus" before shiftSpeed, but then they don't move at all and get spawned at the same location.
The prefab consists of three Rigidbody2Ds which are group to one Gameobject.
Can someone help?
Your answer
Follow this Question
Related Questions
is it possible for velocity vectors to be added on the players axis? 1 Answer
How do I ignore gravity when using Rigidbody and always have the same jump force? 1 Answer
MovePosition/Velocity not following a direction 0 Answers
My bullets don't fire properly 0 Answers
How do I get an object's velocity in one direction? 4 Answers