- Home /
Sword collision detection in VR
Hey guys, I'm currently making a game in the HTC Vive in which you can actually swing a sword and slash enemies/items to do damage to them.
The thing is, I'm trying to make it such that you have to SWING that sword into the enemy to do damage, so moving the sword into them really slowly or just leaving it inside them will do no damage at all.
I didn't use colliders to detect collision because I assume that since the sword will be moving really fast, there is a good chance that it will miss out the collision (If i'm wrong, please point it out to me)
My current implementation is storing the previous location of the sword, comparing it against the current position and time which has passed, and getting the speed of the sword. If the speed of the sword is more than a certain value, I would then grab all objects in between the previous location and current position, and apply damage to them. But... it seems inaccurate, especially when I'm attacking things outside of the play area.
Does anybody have a solution to my issue, or a better way of detecting sword slashing in VR?