Weld Orientation

  1. What do you want to achieve?
    I’m making an archer, when he hits his arrows, i want they have the same orientation as the archer HumanoidRootPart

  2. What is the issue?
    I’m using a weld to hold the arrow model on the player’s parts when it’s hit by the archer.
    But the arrow get the player part orientation when welded.

  3. What solutions have you tried so far?
    I have done a lot of research about CFrames and used many methods like(ToWorldSpace, CFrame.Angles …)

i am using raycast to detect collision


image

1 Like

If you want to preserve orientation during the Weld, save the Arrow’s orientation before it hits the target and once it does, apply it in the weld’s C0

local orientation = arrow.Root.Orientation
...
weld.C0 = arrow.Root.CFrame * CFrame.Angles(math.rad(orientation.X), math.rad(orientation.Y), math.rad(orientation.Z))

Let me know if this helps you out. You can also try changing weld.C1 if the C0 doesn’t change as you’d like. C0 is relative to Part0 and C1 relative to Part1

2 Likes

image
its working fine now, arrows are facing the same direction of archer npc

i also needed to remove the position of CFrame because i wanted it in the middle of part

local orientation = arrow.Root.Orientation
			weld.C1 = hrp.CFrame * CFrame.Angles(math.rad(orientation.X), math.rad(-orientation.Y + 180), math.rad(orientation.Z)) - hrp.CFrame.Position

Thx for helping i was breaking my mind trying to do this!

1 Like