- Home /
Sword slashing logic on Gear VR using controller?
Description
I have a Gear VR game that has a sword fight level and I want to inflict damage to enemies when the player swayed their sword and hits the enemy. Figured I can do this with collision but there are certain problems that I need to address.
Background of the problem
I replaced the Gear VR model to a sword model basically and I can sway and slice the sword with no problem but I want to only damage the enemy if it has been swayed/slash before hit.
Main Question
The sword should not damage an enemy if the user did not sway the sword hard and fast. The problem is if the sword collided with an enemy (getting near) it will inflict damage because of the OnCollisionEnter. How can I do this the smarter way? I need to check if it has been slashed. (Check velocity upon hit perhaps?)
For now, I am still testing possible solution to my problem and will be posting here as answer if I discovered any. Meanwhile, any ideas or answers in regard with this problem is welcome. Thank you for your help.
@billywafuu Hey, did you ever find a solution for this? I'm working on a similar project. I've moved away from trying to compromise some type of non-positional tracking collision sword solution and ins$$anonymous$$d I've become interested in requiring using movement to reach a certain proximity of a given enemy and having some type of rhythmic, back and forth swinging gesture to register a combo of hits. If you have any insight co$$anonymous$$g from the development of your project, I would really appreciate if you let me know. Thanks
Hey there, @billywafuu,
I've got quite a bit of experience with melee combat in VR through Unity and think I can help here, but before I give you any advice could you clarify just one thing?
Are you only interested in dealing damage if the player swings the sword using the sharp part of the blade? Or are you okay having the sword deal damage regardless of which edge is being swung towards the NPC?
Your answer
![](https://koobas.hobune.stream/wayback/20220612162120im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
(Steam VR / Vive) Rigidbody moving in only one direction after collision 1 Answer
Is Build and Run essential to make a Gear VR app ? 1 Answer
Collider question 0 Answers
Google Cardboard, camera rotation not working correctly 0 Answers
Rigidbody magnitude comparison is not working correctlly? 2 Answers