x


Make collider work for some objects

OK, right know I want to create a dropshield like halo reach game. As you know the dropshield not permit the pass of bullets, grenades, rockets, etc., but the player can get in or get out of the dropshield, that means that it has a collider that permit only the pass of a player. I know it could be a simple solution if you make it trigger and when the bullet collides(OnTriggerEnter)the bullet is destroy, but I actually want to make it bounce and also with grenades wont work. So I want a know if there is a code that permit this or a tactic to make the dropshield. Basically I want to make something like this:

dropshield.collider.PermitPassTo(player);
more ▼

asked Jul 02 '11 at 03:32 PM

Uriel_96 gravatar image

Uriel_96
930 61 70 81

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

1 answer: sort voted first

Set your shield and player to different layers, then use the Layer Collision Matrix in Edit > Project Settings > Physics to alter what collides with other things.

more ▼

answered Jul 02 '11 at 03:36 PM

save gravatar image

save
8.2k 22 31 62

wow thanks a lot it really works and no script need :)

Jul 02 '11 at 03:46 PM Uriel_96

ouhh, only one thing, I used a sphere to do the dropshield(with a sphere collider) and all is fine, but when you are inside the dropshield and you shoot the bullets goes really weird. Maybe I know why but don't know how to solve it.

Jul 02 '11 at 03:52 PM Uriel_96

Neat! You could set the bullets to a different layer when you are inside or outside of the shield.

Jul 02 '11 at 04:12 PM save
(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:

x1683
x117
x26
x12

asked: Jul 02 '11 at 03:32 PM

Seen: 851 times

Last Updated: Jul 02 '11 at 04:12 PM