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 Dragonfly3r · Jun 07, 2017 at 06:13 AM · audiotriggersoundpitchdistance check

Checking collision between 2 triggers based on distance. Possible?

The title, I admit might be a bit misleading.

In short what I'm trying to achieve is 2 triggers placed on a single game object e.g. a long rectangle.

The 1st trigger is at the edge of the object and the 2nd trigger is roughly 3 times the distance in front of the 1st trigger as represented by the image below. With the orange rectangle representing the object, the green outline is the 1st trigger & the green box representing the 2nd trigger.

https://i.gyazo.com/94e0f8de6976996a68200c90b56691bc.png

When an object say a sphere hits the 2nd trigger it will play sound of low pitch.

The closer the sphere gets to the orange rectangle the sound will be pitched higher, the variable of pitch changes based on distance of the sphere from the 1st trigger. When there sphere gets closer to the 2nd trigger and further away from the 1st trigger, the sound will begin to pitch lower until it reaches it point of origin and will stop when the sphere is no longer triggering the 2nd trigger.

So my question, is any of this physically possible to do?

To apply a changing variable based on the distance between 2 triggers.

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 TanselAltinel · Jun 07, 2017 at 09:17 AM

There are different ways to solve this, but what I'd suggest is to use different game objects in the hierarchy to manage different collisions.

Otherwise, you can get the object position from OnTriggerEnter and check the distance to the actual game object distance.

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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Get an object to play a sound if player rolls over a trigger. 2 Answers

Wait until audio is finished before set active is false 2 Answers

Need help making an audio trigger. 2 Answers

Making a sound play only once with a Boolean variable in javascript 1 Answer

Activate sound without Pro filters 0 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