Blood spray in the direction the sword is swinging

I want to achieve the blood to spray in the direction of the cut, so getting the direction of the swing or cut

I suck at math and couldnt find a solution so im here

i tried using the blades velocity

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

// in local script, here i send the origin(otherPart.Position), and direction(blade.AssemblyLinearVelocity) of the cut 
  event:FireServer("Damage", false, otherPart, blade.AssemblyLinearVelocity, otherPart.Position)

// in effects script
Engine:EmitAmount(position, direction, 12)

any help is appreciated

3 Likes

What i would do is when you first swing you sword, Grab position at which the blade is at when the animation is raising it, and when the sword hits the NPC take the hit position and use cframe.lookat to get a direction between the two.

--# Blade positions
local raisedPosition = Vector3.new() --> The position of the blade when the character raises the sword to swing.
local hitPosition = Vector3.new() --> The position at which the blade hit the NPC.

--# Final direction
local bloodDirection = CFrame.lookAt(raisedPosition, hitPosition).LookVector --> Direction that the blade is moving.
3 Likes

Thanks alot for replying, very helpful

2 Likes

No need to make a new CFrame just to get the direction between two positions. Just do

local bloodDirection = (hitPosition - raisedPosition).Unit

This is easier to read and makes more sense to do.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.