onCollisionEnter doesn't work without RIgidbody?
Asked Answered
A

3

0

Hi,
I am trying to check the collision between two colliders and OnCollisionEnter() doesn’t work unless one of the object is RigidBody. I can’t use Rigid Body for all the objects as it’s a way expensive…

Also tried with trigger and it doesn’t work without Rigidbody too… Anyone helps me…

Airwoman answered 31/1 at 14:5 Comment(0)
S
0

Correct. As shown in the docs, in order for anything to generate OnCollision events, one of the two objects involved must be a Rigidbody. There’s no way around that.

→ You don’t put a Rigidbody on everything, just the objects that move.

Stemson answered 31/1 at 14:24 Comment(3)

Strategy games are typically done using a grid, so you can check the grid position of each character in an array instead of using physics.

Stemson

But I need two colliders to tell me when they collide. One is a rigidbody.

Studnia

Yea but i have a problem, i have 2 gameObjects, both have Colliders and Rigidbody, but they don´t trigger the OnCollision event, why is it?

Finfoot
S
0

Well since none of these answers actually help solving the OP’s issue, I recommend anyone having this same problem to search about Physics.OverlapBox and/or Physics.OverlapSphere.

Just like this video shows:

But for 3D.

Spunky answered 31/1 at 1:0 Comment(0)
K
0

Source:

Unity - Manual: Interaction between collider types

Kindling answered 15/2 at 12:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.