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 /
This question was closed May 07, 2018 at 08:14 AM by Myth for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Myth · Apr 10, 2011 at 08:53 AM · collisionraycastontriggerenterdetection

Capturing a point

Hi,

What is the best way to test if one object is hovering directly above another for x number of frames?

Note:

  • I also need to send info from the object on top to the one below.

  • there will be multiple points to capture

Thanks in advance for any help!

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

2 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by Myth · Apr 15, 2011 at 02:05 AM

Due to there being many objects trying to capture many objects, Vector3.Distance won't work very efficiently,

Collision is too proving costly and erratic,

Location (array) is too confusing to use on multiple levels

So...

this leaves raycast - which is suddenly not working either.

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
1

Answer by Extrakun · Apr 10, 2011 at 03:29 PM

Use Vector3.Distance to determine if they are close enough. Or you can attach a sphere to the target object, set it as a trigger and switch off its MeshRenderer. Use that sphere's OnTriggerCollide to detect the condition for capture.

To check if an object is on top of another, I will take the capturing object and use Physics.RayCast to cast a ray down and see if it collides with the point to capture. You can also use the output of RayCast to check if the two objects are close enough.

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 Myth · Apr 13, 2011 at 06:51 AM 0
Share

So which way is the BEST?

avatar image Extrakun · Apr 13, 2011 at 07:06 AM 0
Share

It depends on which you prefer. If you rather set the range of capture by tweaking the stuff inside the editor, go with the first choice. If you rather do it inside code, go for the second. What is 'best' for me may not be 'best' for someone else.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Best practice for OnTriggerEnter detection 1 Answer

Multiple/Different footsteps sounds (solved) 2 Answers

Enemy got lit by flashlight detection 1 Answer

Detect when a trigger has entered a collider 1 Answer

How can I make it so that my player only moves if there is no wall in the direction he wishes to move? 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