• Unity
  • Services
  • Made with Unity
  • Learn
  • 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
  • Forums
  • Answers
  • Feedback
  • Issue Tracker
  • Blog
  • Evangelists
  • User Groups

Navigation

  • Home
  • Unity
  • Industries
  • Made with Unity
  • Learn
  • Community
    • Forums
    • Answers
    • Feedback
    • Issue Tracker
    • Blog
    • Evangelists
    • User Groups
  • Get Unity
  • Asset Store

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
5
Question by easilyBaffled · Sep 12, 2012 at 12:43 AM · rigidbodyontriggerentermonobehaviour

OnTriggerEnter without RigidBody

I am trying to move an object through a trigger, and I can absolutely not use a rigidBody. According to http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnTriggerEnter.html I dont necessarily need a rigidbody it says "rigidbody (or the collider if there is no rigidbody)" but it's not working for me. Does it not work for a Sphere Collider, does that not count?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
26
Best Answer

Answer by aldonaletto · Sep 12, 2012 at 01:24 AM

Add a rigidbody to the trigger and check its Is Kinematic checkbox: kinematic rigidbodies don't react to collisions nor suffer gravity effects, but enable the trigger to detect any collider.

Comment
Add comment · Show 7 · 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 easilyBaffled · Sep 12, 2012 at 01:37 AM 0
Share

I can't use rigidbodys the ball freaks out. I've been having problems with rigidbodys because one of my objects is a tube I made in maya and it doesn't work well for some reason.

avatar image aldonaletto · Sep 12, 2012 at 03:53 AM 0
Share

That's why you must make it kinematic: a kinematic rigidbody isn't affected by forces, gravity, collisions etc., but makes the trigger detect simple colliders. Try it.

avatar image easilyBaffled · Sep 12, 2012 at 03:55 PM 0
Share

erp, well thats embarrassing, I thought I had tried that already. Well, thank you.

avatar image jjxtra · Aug 30, 2018 at 09:56 PM 0
Share

Why is this necessary to add the rigid body? Anyone from Unity care to chime in?

avatar image luiscmendez jjxtra · Aug 30, 2018 at 10:10 PM 0
Share

Without the rigidbody component collision checks would be happening on every single collider at any given time in a scene. The rigidbody allows collision checks to be limited to only the object that has the component.

For example, if you're only ever checking against collisions (or triggers checks) from the player to objects in the scene, you only ever need to have one rigidbody that does the check at, the player.

avatar image jjxtra luiscmendez · Aug 30, 2018 at 10:35 PM 0
Share

In my case I found I had to add a rigid body to both my capsule collider (the player) and the other collider. The other collider is a small collider that starts off contained entirely in the player capsule collider, but I still want trigger entered call. Without the second rigid body in the smaller collider, on trigger enter was not called. Is it the receiving collider (the one with the script that has on trigger enter) that must always have the rigid body?

Show more comments
avatar image
0

Answer by luiscmendez · Sep 12, 2012 at 12:48 AM

The shape of the collider doesn't matter. What exactly is your issue? Will the object not pass through? If so, then you probably need to check on the "Is Trigger" box on the object that is the trigger in the inspector.

Comment
Add comment · Show 1 · 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 easilyBaffled · Sep 12, 2012 at 01:23 AM 0
Share

No the object passes through, and the box is checked, but the function wont trigger.

avatar image
0

Answer by mkgame · Sep 26, 2018 at 06:58 PM

Hi, I have similar issue. Kinematic Rigidbodies are slow in Unity 2017/2018. The bug entry is this one: https://issuetracker.unity3d.com/is...ger-time-on-2017-dot-2-0a4-and-later-versions. Rigidbody with kinematic on setting was very fast in Unity 5, but this has changed in 2017 version. I guess if you get OnTriggerEnter, then you can attach the Rigidbody to the GameObject (to simulate the physic if necessary), if needed. Not sure what the best solution is right now. You can wait for the fix and ignore the performance issue, or change back to Unity 5.6.6f2.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

14 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

Related Questions

How do I add a rigidbody in script? 1 Answer

100 OnTriggerEnter Or Tags each player too much? 3 Answers

Increase Speed 1 Answer

Problems with OnTriggerEnter function 2 Answers

Can't get trigger to work 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges