Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 LifeArtist · Apr 22, 2014 at 04:13 PM · triggerenemyfalling-through-floor

Use enemy as trigger just for the char ( not the ground )

Hey,

I'm making a 2D sidescroller game.

I hope the picture is self-explaining ;P

(While the enemy is set to trigger, he can walk through the char but cant fall down)

alt text

Regards,

LifeArtist

untitled-1.jpg (495.0 kB)
Comment
Add comment · Show 3
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 koray1396 · Apr 22, 2014 at 04:23 PM 0
Share

if you absolutely have to set trigger of the collider of enemy, you can add a second collider which is not trigger.

avatar image LifeArtist · Apr 22, 2014 at 04:30 PM 0
Share

But when I'm adding a new collider, the enemy again pushes my char back ^^

avatar image koray1396 · Apr 22, 2014 at 04:41 PM 0
Share

ahh, I wasn't paying attention, you can set which layers will collide with each other from the collision matrix. so enemy would not collide with player layer, but would collide with others.

2 Replies

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

Answer by aceX · Apr 22, 2014 at 04:55 PM

You could use Layermasks to ignore the player's collider, while still using a second collider to stay above ground.

 static void IgnoreLayerCollision(int layer1, int layer2, bool ignore = true);
 
 
 //where layer 1 is your enemy's layer and layer 2 is your player's layer 

http://docs.unity3d.com/Documentation/ScriptReference/Physics.IgnoreLayerCollision.html

Comment
Add comment · 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
0

Answer by LifeArtist · Apr 22, 2014 at 05:25 PM

Okay so ... this is i think what koray mentioned. I disabled for the enemy layer, the character layer.So when I want to find out if the character moves into the enemy, I have to set up a new collider with trigger on :)

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 LifeArtist · Apr 22, 2014 at 05:26 PM 0
Share

But i have to parent a new GameObject with the new collider to my char.

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.

Follow this Question

Answers Answers and Comments

22 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 avatar image avatar image avatar image avatar image

Related Questions

Is there a way to tell which way an enemy is going? 1 Answer

enemy aggro region definitive answer 1 Answer

Enemy falls through floor when both have collider 2 Answers

A trigger to kill all parts of an enemy? 2 Answers

bullets kill all enemies, not just the ones hit. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges