- Home /
 
Trigger Spawning?
I'm trying to get some cargo to deposit into my truck when I drive under a dump and press a certain button. I got it set up to where I could drop cargo at any time by a button press, but I need it to only happen when I'm under the dump. Also, is there any way to limit to one piece of cargo spawned a a time? Thanks.
Here's the code so far:
 var cargo : Rigidbody;
 var speed = 1;
 function OnTiggerEnter(other : Collider){
 if (Input.GetButton ("Fire1")) {
 
 clone = Instantiate(cargo, transform.position, transform.rotation);
 clone.velocity = transform.TransformDirection( Vector3 ( 0, speed, 0 ));
 
 }
 }
 
              
               Comment
              
 
               
              Don't $$anonymous$$d the Tigger... fixed that and it works for spawning... But I'm still not sure on how to only spawn one at a time.
Your answer
 
             Follow this Question
Related Questions
Spawning explosions and detecting objects in range 1 Answer
OnTriggerEnter with exact spot of collision 2 Answers
Collision problem in C# 4 Answers
OnTrigger event when colliders are already touching eachother 1 Answer
Colliding two GameObjects 1 Answer