• 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 David O'Donoghue · Jan 12, 2010 at 03:33 AM · physicsraycastcollidermesh

Returning list of Triangles, Vertices or Points by raycasting through a mesh (iPhone)

I've got a detailed mesh of a car with a transparency texture to give the affect of 'windows'.

To keep the car looking solid (so you can't see through the doors when looking in the window) I've made sure that the inside of the car is also modeled.

T$$anonymous$$s means there the vertices are doubled sided in some parts of the mesh.

What I'm trying to ac$$anonymous$$eve is to select all vertices, points or triangles (either one, doesn't matter) when using RayCastAll.

When I raycastall through the mesh it only returns the first $$anonymous$$t. I've checked the upperbound of the Vector3 array but it only contains 1 element and I've Debug.DrawRay the ray that I'm using and it does pass right through.

Has anyone else experienced t$$anonymous$$s?

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 Jaap Kreijkamp · Jan 12, 2010 at 03:46 AM

Although the documentation isn't really clear on t$$anonymous$$s, RaycastAll returns $$anonymous$$ts of all colliders $$anonymous$$t, but per collider only 1 $$anonymous$$t. So it doesn't give you all $$anonymous$$ts for one collider, just the nearest one.

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 David O'Donoghue · Jan 12, 2010 at 04:46 AM 0
Share

Thank you very much. I'll have to Raycast multiple rays then.

avatar image ravi_gohil999 · Aug 01, 2014 at 07:13 AM 0
Share

Hi David, were you able to solve problem? I am trying to work on a program where I need to cast 1000 rays in circular pattern from a certain point to the distance of 50 metres. Then I need to get the hit distance from each ray and store it in an array.

You think it can be done? Any help is appreciated.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

raycasts only working with IsTrigger colliders? 1 Answer

Melee-like function? 1 Answer

Prevent shooting when gun is inside wall 1 Answer

Raycast hits when missing a collider, misses when hitting a collider? 0 Answers

How to Detect All Mesh Triangles Within a Given Area 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