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 AlbeyAmakiir · Dec 06, 2010 at 08:03 AM · detectioneffectsurface

Detecting all surfaces within a field, locations of surfaces included

I want a player controlled character that can defy gravity and just float around, but only if there is a surface close enough. I think I could do this with a trigger (detect if there's a scenery object within a spherical area), but it wouldn't give me any location information. I would like to have some kind of special effect (such as electrical sparks) go between the character and the surfaces (or portion of surface, for large flat objects) closest to them, preferably weaker with distance (dropping off entirely when too far). Also, I would like the ability to do this to multiple surfaces if there are more than one separate object close enough, though this is less important. The effect may be something similar to F-Zero GX when a car boosts and fires electricity on to the ground behind it.

I considered ray casting (from the character) or checking 3d points for collisions, but I don't know how to do that in Unity, and, if I understand correctly, I'd have to wait for the physics engine to do a separate update before I could get the result anyway.

How would you get a list of all the surfaces close to an individual (and access the location of the surface)? And, for larger surfaces, how would you determine the closest point on that surface?

Edit: By the way, there is no ground. The character and objects float in a void. Also, colliders would push the character away, which is why I don't want to use that.

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

Answer by Proclyon · Dec 06, 2010 at 08:06 AM

Create a secondary collider and paste it on the transform of your original object. Kill all it's functionality and visibility. Activate it's function as soon as the event occurs where you go to this anti gravitational floating mode. This way you can swap between two different colliders.

If this is only for making it look like you float I guess you could just change the Y center value of the character controller instead but that's kind of cheap.

EDIT 11:02 GMT+1 12/06/2010:

When using detection alone you could attempt using a collider with the isTrigger property set. This overrides the collision and sends a message that can be caught with the OnTriggerExit OnTriggerEnter and OnTriggerStay methods that you can read up on if wanted here

P.S. You can catch the collider and use some math if wanted to determine the closest object with this aswell. All the properties such as the transform should be stored in the caught param.

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 AlbeyAmakiir · Dec 06, 2010 at 08:12 AM 0
Share

The problem is that a collider pushes the character away from the object. What I want is just the detection of the object (specifically the closest surface). Also, there is no ground. The objects are all floating, close together, in a void, through which the character can navigate.

avatar image Proclyon · Dec 06, 2010 at 10:02 AM 0
Share

Editing for further explanation

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

No one has followed this question yet.

Related Questions

Is this possible to add effect in exact location where two different objects are colliding? 2 Answers

How to check the collision layer on collision event? 1 Answer

Help 3D Enemy Detection Visual Feedback 3 Answers

How to make a game object detect if any of multiple game objects are in range 2 Answers

Projecting stained glass window onto other surfaces. 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