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..
Answer by Eric5h5
Nov 07, 2010 at 06:17 AM
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.
So.. How about doing something like strategy games? there will be hundreds of moving characters and putting rigidbody on each character will be alot expensive.
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.
Thanks.. I will try to calculate using grid...
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
2 People are following this question.
Which Object Calls OnCollisionEnter()?
Getting OnCollisionEnter to fire on composite object
Further collision beyond the OnCollisionEnter() event
Does OnCollisionEnter only get called when the scripted object initiates the collision?
Why is this script not working?