Trigger events with bullets
I am trying to find a way to use the following code to trigger a target to fall over. However; every way I try to do this I can't get the event to occur.
using UnityEngine; using System.Collections;
public class bullets : MonoBehaviour { public GameObject Bullet_Emitter; public GameObject Bullet;
public float Bullet_Forward_Force;
void Start ()
{
}
void Update ()
{
if (Input.GetMouseButtonDown(0))
{
GameObject Temporary_Bullet_Handler;
Temporary_Bullet_Handler = Instantiate(Bullet,Bullet_Emitter.transform.position,Bullet_Emitter.transform.rotation) as GameObject;
Temporary_Bullet_Handler.transform.Rotate(Vector3.left * 0);
Rigidbody Temporary_RigidBody;
Temporary_RigidBody = Temporary_Bullet_Handler.GetComponent<Rigidbody>();
Temporary_RigidBody.AddForce(transform.right * Bullet_Forward_Force);
Destroy(Temporary_Bullet_Handler, 2.0f);
}
}
}
Any help would be appreciated.
Comment
Your answer
Follow this Question
Related Questions
How do I detect a collision between two objects using Bolt? 1 Answer
I need my timer to only start after it hits a trigger. Please help! 0 Answers
Increase enemy speed when it sees the player 0 Answers
I want to freeze fp player , animation then starts , then unfreeze the character . 0 Answers
Can't trigger animation on Collider2D 0 Answers