|
On rare circumstances, when my controller hits a jumping target I'm getting an error on the following code and I don't really see how this is possible. If OnCollisionStay is called, then I assume there should always be collision, therefore I have to be in contact with something. Obviously I can fixed this by checking for the value, but really want to know if this is just a bug or is there chance under certain circumstances that this could occur. Cheers
(comments are locked)
|
|
Contact and collision are different slightly i think the mesh many be smaller than the collider (which is not a mesh) i think contact only occur if the mesh gets toched but i am not sure! Cool story, bro.
Jun 24 '11 at 02:53 AM
Dreamblur
Why was this down-voted?
Jun 24 '11 at 03:01 AM
AVividLight
So... umm... this answer was based purely on a guess, contradicts a basic and documented knowledge which was specifically mentioned in the original post, and is just plain wrong, yet someone upvoted it. It must be Opposite Day somewhere in the world. 0_0
Jun 24 '11 at 04:16 AM
Dreamblur
(comments are locked)
|
|
Use This:
(comments are locked)
|

I tested this in a PC machine with Unity 3.3, and there were always at least one contact point in OnCollisionStay. Maybe it's a bug related to some specific Unity implementation - Mac, iOS, Android, or even PCs with NVidia GPU (if there's a NVidia GPU, the PhysX engine will use it, changing the way physic is evaluated).
PC, nvidia. I've been using a rigidbody controller for ~6months and yesterday was the first time I've stumbled across the error. The specific case was collision with rigidbody blocks that have had a small force applied upwards to make them jump, and when my character hits the top or bottom (depending if the block is falling/rising) there is a small ~1/100-1/200 chance of the error happening.
My PC hasn't NVidia, thus it processes physics entirely by software. This may explain why this error had not occurred to me. On the other hand, you experienced this error under very specific circunstances. Obviously, the best solution would be to check against zero contacts - but you surelly want to know exactly what is happening. I think a good starting point is to test your software in other machines.