Making an arrow stick into a player properly

Hello, I have a bow & arrow in my game and it currently sticks into the hit bodypart of the player, but I want to make it more accurate in how it appears in terms of impact direction.

So far I’ve managed to make it stick into the player at the correct entry point (the relative point on the surface) and the arrow is correctly offset position-wise using a Weld, but I’m not sure how to make it rotate properly.


Here’s how I’d like it to look:

Here’s my current code:

It does a cast to find the impact point and then gets the relative object space of the impact point compared to the hit instance’s CFrame. It sets the C0 of the weld to the relative impact CFrame.

local arr = game.Workspace.Arrow

local pos1,pos2 = game.Workspace.a1.Position,game.Workspace.a2.Position
local direction = pos2-pos1
local dist = direction.magnitude
local width = 0.1

local params = RaycastParams.new()
params.FilterDescendantsInstances = {game.Workspace.StarterCharacter}
params.FilterType = Enum.RaycastFilterType.Whitelist

local hit = workspace:Spherecast(pos1, width, direction, params)

if hit then
	print("Arrow hit:", hit.Instance:GetFullName())
	
	local impact_offset = hit.Instance.CFrame:ToObjectSpace(CFrame.new(hit.Position))
	
	arr.Weld.C0 = impact_offset
	
	arr.Weld.Part0 = hit.Instance
else
	print("Nothing was hit!")
end

Any CFrame geniuses gonna help me with finding the relative impact rotation? :disguised_face:

Changing impact_offset to this worked for me

local impact_offset = hit.Instance.CFrame:ToObjectSpace(CFrame.new(hit.Position, pos2))
1 Like

Works perfectly, thanks much!

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