Raycast does not fire in the part's Look Vector

Hi! I’m working on a Doctor Strange ability and I’m trying to fire a ray from a part welded to the player’s Right Hand. As you can see, I’m firing it in the Look Vector’s direction, but for some reason when I use it the ray goes right.

Code:

local start = player.Character.IcyTendrils.Flames
	
	local raycastResult = workspace:Raycast(start.Position, start.CFrame.LookVector*500, raycastParams)
	
	if raycastResult then
		print("Object/terrain hit:", raycastResult.Instance:GetFullName())
		print("Hit position:", raycastResult.Position)
		print("Surface normal at the point of intersection:", raycastResult.Normal)
		print("Material hit:", raycastResult.Material.Name)
	else
		print("Nothing was hit!")
	end

When I use it:


I’ve rotated the part in every direction. It still hits the part to its right instead of the one in front.

Any help is appreciated.

1 Like

You need to reset the part’s orientation to Vector3.new(0, 0, 0) such that its ‘LookVector’ describes a front-facing direction.

4 Likes

I did it and the indicator shows that it’s facing forward, but the ray now goes downward.

1 Like

Ignore what I said. Resetting the orientation works, but the ray was fired so fast the animation didn’t have time to raise the hand. I need to sleep. Thanks a lot for the help!

1 Like

I don’t understand what you mean by this, I reset the orientation on the part, which just made the raycast fire in one specific direction, I need the raycast to fire in the part’s current orientation.
(Maybe I’m missing something, but after resetting the orientation to Vector3.new(0, 0, 0) it just ruined the part’s rotation)

1 Like