- Home /
Question by
Bslashingu · Sep 14, 2012 at 04:56 AM ·
playerenemybulletshoot
No collision on trigger and character controller
I'm trying to make a bullet object that travels across the level and destroys what it hits. When I use an OnTriggerEnter or OnCollisionEnter, it doesn't detect any collision whatsoever. Here is my code:
bulletScript.js
#pragma strict
var playerObject : GameObject;
var bulletMove : Vector3;
var bulletLife : int = 2;
function Start () {
while(true){
yield WaitForSeconds(bulletLife);
Destroy(gameObject);
}
}
function getBulletSpeed(bulletSpeed : Vector3){
bulletMove = bulletSpeed;
}
function Update () {
transform.Translate(bulletMove,Space.Self);
}
function OnCollisionEnter(collision : Collider) {
Destroy(gameObject);
}
And here are some screenshots of my setup
Comment
Your answer
Follow this Question
Related Questions
Problem with enemy shooting 4 Answers
make Enemy shoot at player 2 Answers
Shoot directions 2 Answers
Hit enemy life 0 Answers
Shoot Bullet Delay Enemy 0 Answers