Richard Muthwill
Richard Muthwill

Reputation: 336

Does a VR object need a Rigidbody for a collider?

In Unity3D, you need rigidbodies on GameObjects that use colliders, as they use physics. You don't need rigidbodies on static GameObjects because they don't use physics, though you still need to have at least one in the calculation.

My situation is this: I want the game to detect putting your head through a wall with colliders. I'm just curious, as the collider on the head won't use physics, does it still need a rigidbody as it's moving, just not with physics?

My question is: Does a VR object need a rigidbody? (and yes it set it to kinematic)

Upvotes: 0

Views: 2917

Answers (1)

derHugo
derHugo

Reputation: 90823

Colliders → Collision action matrix

=> It depends.

Some of the combinations only cause one of the two objects to be affected by the collision, but the general rule is that physics will not be applied to an object that doesn’t have a Rigidbody component attached.

enter image description here

enter image description here

You said

as the collider on the head won't use physics

But note that in general Collision = Physics.

So yes, at least one of the objects involved in a collision needs to be a (kinematic) Rigidbody.

As you can see in the matrix above e.g. for a collision with a static object the event (like OnCollisionEnter) will be invoked only on the object with a (kinematic o not) Rigidbody but not on the static object.

static here means it has no Rigidbody component attached even if it is moved by code or in other words: As soon as something moves in your scene it should have a (kinematic) Rigidbody component!

You can add colliders to a GameObject without a Rigidbody component to create floors, walls and other motionless elements of a Scene. These are referred to as static colliders. At the opposite, colliders on a GameObject that has a Rigidbody are known as dynamic colliders.

Upvotes: 2

Related Questions