- Home /
RigidBody vs Collider
Hi All,
Can you please help me with this one?
What is the difference between having a game object with collider component and rigidbody component and the rigidbody component is kinematic vs a game object with collider only?
Afterall kinematic rigidbody doesn't obey the physics rules so what is the point of doing it? I saw some tutorials doing it for collision detection but for collision detection I can use collider without any rigidbody so why adding kinematic rigidbody?
Thank u in advance
If i had to guess, i'd say that you need both a rigidbody (for physics stuff) and a collider (collision detection). otherwise your objects would hit each other and fly all over the place.
That's my guess, i haven't worked with Physics so far
But what is the meaning of game object with kinematic rigidbody and collider to one without rigifbody at all? after all kinematic rigidbody doesn't obet physics
Answer by Eric5h5 · Jun 16, 2011 at 05:03 PM
You can't have collision detection with only colliders and no rigidbodies. The point of kinematic rigidbodies is that you can move objects around directly (without physics), and still have collisions. Also, moving static colliders is bad, because the scene graph has to be recalculated, so generally objects that are being moved should be rigidbodies.
With "moving static colliders is bad" do you mean objects with collider, marked as Static in inspector, or any objects without rigidbody?
He is referring to objects that are not static, no rigidbody, but have a collider. These objects are normally walls or floors. So they should not move anyway.
If you need to move something, for example, have a platform that moves vertically (like an elevator in old games), then you should set that platform to have both a collider (box collider in this case) and a rigidbody that is set to is$$anonymous$$inematic.
Answer by Bampf · Jun 17, 2011 at 04:05 PM
You can indeed have a collider with no rigidbody. If there's no rigidbody then Unity assumes the object is static, non-moving. Unity does not bother testing for collisions BETWEEN static objects. As you can imagine, this is very efficient if you have lots of scenery the player can bump into.
So the purpose of having a kinematic rigidbody, rather than no rigidbody, is to turn on collision detection between this object and all other colliders in the scene (even the static ones.) Effectively you are letting Unity know that this object moves around, so Unity will then do collision-detection between it and everything else.
(If you had a game with only two objects in it, and both move kinematically, in theory you would only need a rigidbody on one of them, even though they both move. I haven't tried it. But now imagine three such objects- you'd have to have rigidbodies on two of them. So in practice you'll usually just put rigidbodies on everything that both moves and collides.)
I don't have the karma to give you a thumbs up yet, but I wanted to thank you! This answer is the clearest one here (to me), and totally solved my problems! So thanks!
Thanks for letting me know! I like karma points, but I like knowing that I helped someone even better.
I too lack the karma to give you a thumbs up, but your answer in particular made a lot of sense to me and clarified the collider versus rigidbody question well. I was confused why a few days ago I needed a collider and a rigidbody in order for my player to react to a house model imported from Sketchup, but this morning, I only need a collider (after re-importing). After reading your answer, I can conclude that a collider should be all I need, and I suspect some of the scaling or movement I did after importing it the first time confused the physics engine long enough for me to decide that I also needed a rigidbody that I shouldn't actually have on such a static object.
Answer by Owen-Reynolds · Jun 17, 2011 at 03:15 PM
The Kinematic setting solves certain occasional problems. In general, don't use it, but remember it's there. Two examples are turning on/off physics, and hinges:
You have a catapult with a child bullet in the scoop. Set kinematic to freeze it. When it is fired, unset Kin and give it a speed.
Say you want an animated object to ragdoll on death. For the ragdoll, you have to give all the bones rigidbodies. You start all bone RBs as Kinematic, to "turn off" physics, letting normal animation control everything. When it dies, you stop all animation and set all bone Kinematics back to false ("turn on" physics,) to let the ragdoll take over.
Hinges can only be linked to rigidbodies. Say you want a gate linked to a immobile post. You keep the post frozen but make it count as an RB by setting it kinematic.
Great info! I wish I had the reputation to +1 this!
Answer by Miladsob · Jul 20, 2020 at 09:05 PM
This tutorial from Learn department of Unity is very useful to understand Rigidbody, Collider, and difference between them
Answer by biohazard · Jun 16, 2011 at 10:06 AM
Think about special effects like rockets. since kinematic rigidbodies aren't affected by physics you could let them float up on Start.
a trail renderer, an explosion script and a trigger. You now have fireworks
That's not a good example; rockets should be affected by physics. You would use AddForce to launch them and probably use a constant force component.
how about you quit downvoting everyone whos not as perfect as you eric?
I downvote answers that are not helpful or incorrect. That's one of the points of this site and other sites like it (along with upvoting answers that are helpful, of course). I expect people to do the same with my answers. If you're going to take it personally, you should leave.
Your answer
Follow this Question
Related Questions
how to check for collison with a navmeshagent 0 Answers
Moving kinematic rigidbody trigger against kinematic rigidbody collider 0 Answers
Rigidbody bounce or character controller istrigger issues 0 Answers
Get all child not working? 1 Answer
Under what circumstances are compound colliders created? 0 Answers