I've created a character that moves it's sword around using mouse input (ie moving the mouse up makes him raise his sword). This is not an animation, it is transforming the model via script. I want the damage system to take in to account how fast the user is moving the mouse, where a slow movement does little or no damage and a big swing could take off the limb it hits.
I can't find the right way to make collsions work. I made the sword a kinetic mesh collider attached to a rigidbody with a trigger. I can get collisions using OnTriggerEnter, but it seems that i cant get the colliosn to pass vector/magnitude information to try and determine how fast it hit. The sword also passes straight through.
asked Jun 03 '10 at 08:17 AM
If your motion of the sword is based on the mouse movement, you could actually use the mouse delta values as your "damage amount" value.
Another method would be to create a dummy gameobject which is parented to the tip of the sword, and measure its position each frame. You can then calculate its speed by comparing the difference between the last measured position and the current position.
answered Jun 03 '10 at 09:42 AM