- Home /
Accurate Collision Detection and Impact Physics Calculations
Hello everyone, I am making a boxing game using Unity 3D and the Kinect. Currently I am using rigidbodies, triggers, and a little math to handle collisions and force. I am using Unity's built in collision detection for my sphere collider (hands) and a box collider for my target (enemies). Every update tick, I am recording the current position and time. Then, whenever a collision is triggered, I am using the new position, old position, and elapsed time to determine the velocity. I am then using the velocity and mass to calculate my force and am applying as an impulse force to my target. Here are my two issues:
1) How do I improve the accuracy of my collision detection? Sometimes my hand travels through my enemy. I am using the Kinect, so my hands can move pretty fast. Not much else is going on in this game, so there isn't much processing needed in other parts.
2) How can I improve the quality of my impact physics? Currently my mass is an arbitrary "1", and the scale of my arms (in game distance) is unknown. Is there a better way to calculate impact force?
Answer by TheDarkVoid · Apr 18, 2012 at 08:29 PM
You can edit how accurate collision detection is the Edit>Project Settings>Physics Menu. That should be all you need to tweak, increasing the the accuracy too much will cause lag.
Thank you, I am looking in there. Which settings need to be tweaked to increase Collision Detection?
Unfortunately, I think your problems are a little more serious than that. The reason the collisions aren't working properly is because in one frame, your hand is entirely on one side of an object, and in the next frame it is entirely on the other! You will need to implement some kind of raycasting collider to solve this problem.
Your answer