Question by
BokuDev · Mar 08, 2016 at 03:40 PM ·
collisioncolliderscollision detectiontriggers
Trigger a box collider based on force of an object
Hi I'm making a game with sword motion controls and I want to make the sword combat sort of realistic in the sense that the player has to swing the sword with real swings to trigger the box collider trigger on the sword.
How can I accomplish that with C#? Do I detect the force of the object or the speed?
Comment
Answer by Salocin19 · Mar 08, 2016 at 04:32 PM
You could check the velocity of the RigidBody component and if it's above a certain value execute the collision code:
http://docs.unity3d.com/ScriptReference/Rigidbody2D-velocity.html