Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Servail · Dec 18, 2017 at 05:51 PM · collisionraycastingpointexitentry

Raycast, OnCollisionExit - most efficient way to get outcome or exit point on Collider?

The thing is, I want fast(!) Rigidbody(!) bullets (so, drag and gravity included) to come through Colliders in certain circumstances, and give me info of entry and outcome points, like collision.contacts OnCollisionEnter, to carefully place decals or something. Using just OnCollision is simple by disabling bullet Collider or IgnoreCollision for a millisecond, switch attempt stance, and rereflect velocity, but gets to unconsistent results, like displacement of contacts. It's easy to get income point by just raycasting ahead, but I can't get right outcome point even with Queries.hitBackfaces... but this is too expensive anyways. I'll try to combine these next time. But maybe I'm just reinventing the bicycle? Any suggestions? P.S.: Still can't believe this function is not implemented by default...

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

1 Reply

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

Answer by Servail · Dec 20, 2017 at 12:45 AM

So, I'm just realized bullets can be triggers and receive OnTrigger calls. I've added another trigger Collider and now i can predict collision or model my own, based on penetration, in example. Raycasting forward/backwards OnTriggerEnter is probably the best method for precise determining entry/exit points (so as thickness). UPD: Whoops... If velocity is too high (like 1000), trigger can't do the trick. It's just come through (ofc I'm using continuous dynamic) until you enable collider, but then it can't predict collision enough much ahead, and collision called (so does trigger, lol). You need to extend trigger, and this results in huge performance drops and unsuspected behavior (so it extends along transform.forward, not velocity). Raycasting ahead every FixedUpdate is much better and efficient, and already gives hit point. So, I'm just was trying to reinvent the bicycle? But raycasting every FixedUpdate for many bullets is not much of a deal... I still will be trying to find solution in one-two calls.

Comment
Add comment · Show 2 · 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 nt314p · Dec 20, 2017 at 12:47 AM 0
Share

How did you deter$$anonymous$$e this?

avatar image Servail nt314p · Dec 21, 2017 at 03:13 AM 0
Share

By Physics.Raycast towards bullet velocity (entry point), then collider.Raycast against ray.direction on some point (which is maxThickness) on that ray (exit point).

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

120 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 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 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 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 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 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 check collision for a line rendered by a line renderer? 2 Answers

Long animation entry and exit. 0 Answers

Obstacle avoidance 1 Answer

Why does this script check for raycast collision? Is it necessary? 1 Answer

Help Understanding Raycast 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