- Home /
ObjectSpawner
I want to make an objectSpawner I already know how to make it, but I want to makewhen the objects are spawned that they fly over the screen like they are been throwed. And then after it goes slowly down.
So what I thought is a little bit about this.gameObject.rigidbody.AddForce and more about physics things, so...
Maybe you guys now what I mean, it must be a little like fruit ninja the fruit gets throwed, but mine must come down after the object are throwed.
Thanks guys for reading and helping!
am I did that without any force
I just placed a sphere around -0.5Y axis and spawner at 0Y axis and if I had 0.2/s I got a pretty cool thrower if I spawned at about 1/s I got allmost nothing allmost none thrower.
but you you want just make on start add force axis Y 10, ...
something like that
doing just general directions
Oke I will try it out but still if others have any suggestions give me some thoughts! ' Thank btw.
The answer you gave is unfortunately not what I want. The thing is that it must go up in Y as of course but I want to have it like that Instiated object is getting pushed like "boom" and then it flies in the heaven and it goes slowly downwards.
Answer by robertbu · Mar 26, 2013 at 07:37 PM
It is a difficult to figure out exactly what you want from this discription. I'm going to make some basic assumption. Your camera view is the default looking toward positive Z, and you are using Rigidbody components. To go in random directions you can do something like:
var v3 = Random.insideUnitySphere;
transform.LookAt(transform.position + v3);
var go = Instantiate(prefab, transform.position, transform.rotation);
go.AddForce(go.transform.forward * 500);
To get the object to slow, up the Drag setting in the Rigidbody. If you want to limit some direction, you can manipulate the v3 before doing the LookAt. For example, if you only want them going up, you could:
v3.y = Mathf.Abs(v3.y);
Or if you wanted to limit the upward velocity, you could do something like:
v3.y = Mathf.Clamp(v3.y, 0.0, 0.4);
Your answer
Follow this Question
Related Questions
Nav Mesh Agent won't fall off the platform? 1 Answer
How do you aim towards mouse when two objects are moving? 1 Answer
Accurately lob an object at a target 1 Answer
Force to reach point 1 Answer
Bullets spawn behind plane? 1 Answer