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 steamb · Jul 18, 2018 at 02:38 AM · collidertriggerscaleontriggerenter

change the scale of collider to trigger "OnTriggerEnter",Change the scale of collider to trigger "OnTriggerEnter"

Hi guys, Here is my question, I want to change the scale of a sphere collider to trigger other gameobjects (also with sphere colliders), but only few gameobjects trigger the "OnTriggerEnter".

I try to use script, to reset the scale value, or use dotween to DOScale it, or set the radius of collider, still the same, only few gameobjects trigger the "OnTriggerEnter".

I try to move the collider to touch other gameobjects. On mater use script or move in runtime, they are all work well.

So, dose anybody has the same problem like me? How can I scale a collider to trigger "OnTriggerEnter"?

Comment
Add comment · Show 8
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 Piyush_Pandey · Jul 18, 2018 at 01:09 PM 0
Share

For OnTrigger to work you must have:-

1) Collider attached to the gameobject

2) Script attached to the same gameobject

$$anonymous$$ake sure these are correct for all the objects you want to get triggered.

avatar image hexagonius · Jul 18, 2018 at 01:36 PM 0
Share

scale is the one thing that can't be expressed in any kind of velocity, so there's no smooth way to do this. if you do though, DOtween must run the scaling in FixedUpdate.

avatar image pako · Jul 18, 2018 at 01:38 PM 1
Share

It might be a case where the scaling is done too quickly. This is always a problem with fast moving objects (and of course their colliders). The root cause is that collisions are calculated by the physics engine in one frame just before the "problem object", and then, when they are again calculated in the next frame, the collider has moved beyond the "problem object" so, it never actual touches the collider (being inside the sphere collider doesn't trigger).

You can check if this is the root cause, if you reduce the speed of scaling. If that's the cause, just google something like "Unity fast moving gameobjects colliders" or something similar. There are many topics on workarounds.

avatar image steamb pako · Jul 19, 2018 at 04:22 AM 0
Share

What u said is make scene for me, I made a test that doing scale really slow, but it still works bad.

avatar image Harinezumi · Jul 18, 2018 at 01:48 PM 0
Share

A trigger collider will only be triggered by dynamic collders, that is ones that have a Rigidbody on them, as seen in the table at the bottom of this page: https://docs.unity3d.com/$$anonymous$$anual/CollidersOverview.html
That is, your static colliders will not trigger it (makes sense if you think about it). $$anonymous$$oreover, if I remember correctly (but I haven't tested it), dynamic colliders that are not moving also do not trigger, because they are "asleep". This means that if an object has a Rigidbody, but its transform is not affected by anything (neither forces, nor velocity, nor directly setting position or rotation), then scaling the trigger will not detect that it entered the trigger.

avatar image steamb Harinezumi · Jul 19, 2018 at 04:27 AM 0
Share

Of cause I add the rigidbody, and it works well when I move it to touch other gameobject.

avatar image steamb Harinezumi · Jul 19, 2018 at 04:29 AM 0
Share

but its transform is not affected by anything (neither forces, nor velocity, nor directly setting position or rotation), then scaling the trigger will not detect that it entered the trigger.

Okey,

avatar image steamb · Jul 19, 2018 at 04:41 AM 1
Share

Thanks guys, I was using another way to solve this temporary, calculate the distance of the mian gameobject to others, and compare with the radius of sphere collider.

0 Replies

· Add your reply
  • Sort: 

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

127 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 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 avatar image

Related Questions

Register Particles going through Trigger collider 1 Answer

Check if something enters my trigget withowt OnTriggerEnter 1 Answer

Why doesn't this work? Comparing gameobjects in OnTriggerEnter 1 Answer

Disable Mesh Collider Trigger 1 Answer

Character collider falls away unless "isTrigger" selected 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