I am trying to make my punch do more damage if the enemy is hit on the back.
I've tried using raycast, but I'm really not sure how to making it find the surface of the brick. Any help?
I am trying to make my punch do more damage if the enemy is hit on the back.
I've tried using raycast, but I'm really not sure how to making it find the surface of the brick. Any help?
This discussion is preserved as it was. New answers, comments, and votes are closed.
7 comments
https://scriptinghelpers.org/questions/16186 and https://scriptinghelpers.org/questions/16086/#19313 should be what you want
It's obvious users create a BasePart on the back of their torso and detect collisions like that. If there's another way you may use that.
Alternatively you could look into finding the angle between the surface normal and the lookVector of the part you've hit. If it's >175 degrees or something treat it as the back.
https://scriptinghelpers.org/questions/61353/#59702 for angle stuff
The issue with creating a part on their back is that tools and arms go through other parts, so it could be hit from the front.
Depends what tools, and how you've scripted the character. CanCollide can fix it can't it?
Limbs of characters are always CanCollide false. Even if you set it to true, it automatically gets set to false. Tool you can have CanCollide true but it's usually not good since you'll be bumping into walls and obstacles with them.