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 /
This question was closed Sep 22, 2016 at 11:18 PM by Trevdevs for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Trevdevs · Sep 22, 2016 at 02:04 PM · meshraycasting

Is it possible to make 2 raycast's collide with eachother?

Basically i'm doing my own custom procedural dungeon generation I have the rooms being generated correctly but now I need to create hallways that will link the rooms together and the way I thought of doing it is as diagrammed below.

alt text

untitled.png (13.3 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 iabulko · Sep 22, 2016 at 03:29 PM 1
Share

I don't think you need raycasts. Just create lines and get the 2 lines crossing point: https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection

avatar image Bonfire-Boy iabulko · Sep 22, 2016 at 04:30 PM 0
Share

Agreed, ray casting seems way over the top for this kind of thing.

avatar image ArturoSR · Sep 22, 2016 at 03:40 PM 0
Share

You are generating them as if they were square rooms?, If not, you could have a big trouble trying to match the spaces between them if the hallways are not the right size, and no, you can make two raycast hit at intersection points, normally you check the Bounding Box for the volume distribution or implement some grid generation, cheers.

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by Sergio7888 · Sep 22, 2016 at 04:34 PM

Rayscast only hit Colliders, you need your room generator script use the room position to calculate the intersection point.
Example:


Vector2 roomA; //set with Room A position
Vector2 roomB; //set with Room B position
Vector2 IntersectionA=new Vector2(roomA.x, roomB.y);
Vector2 IntersectionB=new Vector2(roomB.x, roomA.y);
Comment
Add comment · Show 3 · 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 Bonfire-Boy · Sep 22, 2016 at 04:38 PM 0
Share

$$anonymous$$ore generally, they'd need to construct lines from the door positions (in whatever directions) then use a line intersection algorithm (see iabuko's comment) to find the corner points.

avatar image Trevdevs Bonfire-Boy · Sep 22, 2016 at 11:20 PM 0
Share

The bounding box is not necessary as the gameobject's transform is the origin of the room so simply drawing from that point that is already stored will be the best solution along with some basic Area and Pythag math to solve for the length and width from the room.

avatar image Trevdevs · Sep 22, 2016 at 11:18 PM 0
Share

That will work although that diagram is just a sky view the actual game it is included in is 3d not a problem though I know how to convert it thanks :)

Follow this Question

Answers Answers and Comments

63 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

Related Questions

How to render a lot of the same small objects 2 Answers

Create Vision Cone for Torch Effect Using Mesh 0 Answers

How can I create a 3d mesh using raycasts? 0 Answers

Raycast not working on terrain 0 Answers

Change an object's import settings in the editor 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