• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Lautaro-Arino · Jan 12, 2014 at 11:52 PM · physicscollider

Bullet not colliding with dying enemy

When an enemy is shot and is playing death animation id like it to still not go through walls but not collide with bullets. How would i do this?

The enemies have Rigidbody2D, are not kinematic and have Collider2D that are not triggers. The bullet (fireball) has a Rigidbody2D and a collider which is trigger.

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image getyour411 · Jan 12, 2014 at 11:57 PM 0
Share

You could create a new Layer and once the enemy is dying change its layer to that new Layer, and set your bullets to ignore physics on that layer. Would that work?

avatar image Lautaro-Arino · Jan 13, 2014 at 12:22 AM 0
Share

But if it ignores physics doesnt it fall through the floor?

avatar image getyour411 · Jan 13, 2014 at 12:28 AM 0
Share

I converted your last update to a comment ins$$anonymous$$d of an Answer. To clarify, I didn't say to set it to the ignore physics layer generically, I said to change it to a layer that your Bullet does not interact with. You can set layermasks for this. Does that help?

avatar image Lautaro-Arino · Jan 13, 2014 at 12:32 AM 0
Share

Oh, i have no idea. I have not looked into different layers. I did not know there could be different layers for physics. Do you have any tip on good tutorial about this?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by getyour411 · Jan 13, 2014 at 12:55 AM

The Unity doc has some good examples. Changing layers via script is also covered. Example: Once enemy is dying change it's layer to someLayer On the bullet script, add a variable like

 public LayerMask bulletLayers;

That will add a dropdown in your Editor, place checks next to the layers you want it to interact with, don't check the layer marked someLayer.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lautaro-Arino · Jan 13, 2014 at 01:11 AM 0
Share

Sounds like i need to befriend this technique. Thanks!

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

SphereCastAll doesn't seem to be working 2 Answers

Importing from Skecthup characters and adding physic. 0 Answers

Velocity data from OnCollisionEnter is delayed (incorrect) 2 Answers

Change particle bounce relative to the speed of the GameObject colliding with them? 1 Answer

Tree Colliders Not Working With Physics.CheckSphere / Capsule 4 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges