x


question about invisible walls

so i created some invisible walls around parts of my game, but what annoys me is that rockets and stuff explode when it hits the wall. is there anyway that i can make it so only if a game object has a variable on it then it cant pass through, like:
if(cantGoThroughWall){
//some script here to make it not go through wall
}
or is there another way that i just dont know about?

more ▼

asked Feb 18 '10 at 08:33 PM

Adam Bruns gravatar image

Adam Bruns
274 24 27 38

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

2 answers: sort voted first

Maybe there's a simpler way. Have you tried Physics.IgnoreCollision?

It even has an example exactly about bullets:

// Instantiate a bullet and make it ignore collisions with this object.
var bulletPrefab : Transform;
function Start () {
    var bullet = Instantiate (bulletPrefab);
    Physics.IgnoreCollision(bullet.collider, collider);
}
more ▼

answered Feb 18 '10 at 11:02 PM

Cawas gravatar image

Cawas
1.5k 31 38 54

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

If you look in the Scripting Reference there is Physics.IgnoreCollision or something similar that will do just that.

more ▼

answered Feb 18 '10 at 10:41 PM

Will gravatar image

Will
408 8 10 19

Sorry, when I started answering yours wasn't loaded on my page yet! :o

Feb 19 '10 at 01:20 PM Cawas
(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:

x5270
x2170
x1403

asked: Feb 18 '10 at 08:33 PM

Seen: 1759 times

Last Updated: Feb 18 '10 at 08:33 PM