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 Kaze_Senshi · Feb 01, 2012 at 02:35 AM · 2dcollisiontriggerontriggerenterlerpz

OnTriggerEnter detection too late

Hello guys, I am with a problem that I have no idea how to solve elegantly. Well, my game has a character that can dash like an arrow. My idea is to let the enemies have a trigger area where you can dash and kill them. See the next figure:

alt text

The problematic enemy is this wallPin. It has three colliders, the body collider(normal), one in the point to kill the player(trigger) and another in the head where you can dash and kill it(trigger). These colliders are attached to the armature, following the "digging" animation in the pics 1 and 2. If the player is dashing and collides with something with a normal with an angle 180, the dash ends, and the problem is... In the picture the player rebounces at high speed ( app. 40 units of speed following Lerpz 2d engine ) between the 2 white cubes and goes up in the direction of the head, following the blue line. Then the collision detection first detects the collision with the pin's body, cancelling the dash, and after it sends the head's trigger enter message. With this late message, the player is not more dashing and the enemy won't die. The trigger detection code to kill enemies is:

 function OnTriggerEnter (other : Collider) 
 {
     Debug.Log( other.name +  Time.time );
     var platformerController : PlatformerController = other.gameObject.GetComponent( PlatformerController );
     if( platformerController && platformerController.isDashing()  )
     {
             enemyLife.getHit();
     }
     else if( platformerController && !platformerController.isDashing() ) 
     {
         Debug.Log( platformerController.isDashing() + other.name +  Time.time  );
     }
 }

 

So with someone knows how to make the trigger detection more precise or faster, please help me, I tried to put rigidbodies, change the square for a circle, put a rigidBody on the player, etc.

Comment
Add comment · Show 1
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 Kaze_Senshi · Feb 01, 2012 at 02:38 AM 0
Share

Ahhh, if I dash perpendicularly to the pin, hitting the head following the yellow line, it works well, because there is not a collider in the other side of the trigger.

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

I'd like some help with my health / shooting (collision detection) 1 Answer

2D Triggers and Collisions not working as expected. 2 Answers

How to handle animation of multiple Coins? 1 Answer

Detect when a trigger has entered a collider 1 Answer

Collision Detection - Strange issues! Working when it shouldnt, not working when it should! 2 Answers


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