I am trying to achieve accurate hit registration with parry
i am not sure which method should i use, what i thought about was 1, adding hitbox to the sword and using Touched events. 2, using raycast along the blade where i could maybe even detect where sword hit. or if theres any better method
i am not sure if there were around 50 swords active, which method would be better
if anyone has experience with this i will appreciate any help
In the past what I have done is made “Parry” an effect that players can have for about 0.1 seconds. If the player is hit by a parryable attack while they have the Parry effect, the attack is parried
Hello, It depends on the sword size… if you got a small sword, you could use raycasts along the blade (some like 3 raycasts, 1 on the left, 1 on the middle, and 1 on the righ side), but if you have something bigger and you want precision i believe you can use :GetPartsInPart()
edit: also i dont recommend using .Touched with hitboxes because it can get buggy and laggy sometimes
So now that I know what you mean by hit registration, I can suggest using Shapecast -like functions for this. It allows you to cast entire shape to detect where and what it would hit.
Its performance is good enough to be used many times per frame (like raycasting for small shapes). It won’t return a hit if the part is already intersecting, so you should Shapecast forward slightly in the direction of the swords motion
i have a pretty thin katana so i think one raycast from the grip to the tip of the blade would be enough, right now torn between raycast and shapecast, which is better for performance?
If you have a thin katana, I think a raycast would be good—a raycast hitbox. You’d define points on the sword and then raycast from those points, in the direction the sword is moving when animated, to detect hits.
To get to get direction, just get the difference between the current position and last position of the points. That’ll give u the vector for the raycast direction.