x


My rockets are going through buildings?

Hi the problem im having is that when my airplane is firing rockets, the rockets cant collide with anything in the world i have created, they just go through the walls. This is the script i have on the rockets. The rockets are rigidbodys.

var explode: Transform;

function OnCollisionEnter(collision : Collision)
{
    Instantiate(explode,transform.position, transform.rotation);
    Destroy(gameObject);
}
more ▼

asked May 30 '10 at 05:52 PM

Marcus gravatar image

Marcus
41 6 6 11

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first
more ▼

answered May 30 '10 at 07:05 PM

jack 1 gravatar image

jack 1
464 31 40 56

(comments are locked)
10|3000 characters needed characters left

Try setting up some rigid body physics for the building's as well, which would also keep the character from walking through them as well.

more ▼

answered May 30 '10 at 06:00 PM

jack 1 gravatar image

jack 1
464 31 40 56

ive done that the plane cant go through the buildings but the rockets can so frustrating.

May 30 '10 at 06:32 PM Marcus

http://unity3d.com/support/resources/tutorials/fpstutorial Check out the tutorial for starters, and also he brings up a good point.

May 30 '10 at 06:56 PM jack 1
(comments are locked)
10|3000 characters needed characters left

If you're firing a rocket, it may be that the rocket is traveling too fast to hit the building. So if it's going at a couple hundred feet per second, the frame where it would collide with the building is not ever actually hitting. If that is the case, try using a Raycast to detect collision.

more ▼

answered May 30 '10 at 06:46 PM

karl_ gravatar image

karl_
2.4k 41 53 69

yeah but should`nt it work when i slow down the speed of the rocket

May 30 '10 at 07:07 PM Marcus
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1682
x274
x68

asked: May 30 '10 at 05:52 PM

Seen: 1035 times

Last Updated: May 30 '10 at 05:54 PM