How to offset off of torso, but ignore the vertical values (y) or keep it straight forwards?

  1. What do you want to achieve?
    I want to make a dash effect that offsets infront of the torso by 25 studs, and my effect is 50 studs long. I want to ignore the vertical values so that it can be straight ahead and not downwards.

  2. What is the issue?
    The effect is facing the correct way, but it is supposed to be straight forward and not downwards. I think this is because of moon animator affecting the torso cframe causing the offset to be straight from the torso, which is downwards.

Here is my code:

					local modelclone = originalmodel:Clone()
					modelclone.Parent = workspace
					modelclone:SetPrimaryPartCFrame(torso.CFrame*CFrame.new(0,0,-25))

Here is what happens: https://gyazo.com/1cdcd77fd03aacc231e2f8bca491840d

  1. What solutions have you tried so far?
    I couldn’t find much solutions or similar posts, and it’s probably because I use moon animation that affects the torso angle and causes the attack to go downwards. I also tried using LookVector and ignoring the y value but it still doesn’t work.

I know but I want it as torso on purpose because for the attack, I anchor the humanoid root part for a second then it activates. When you shift lock the humanoid root part doesn’t rotate but the torso does, and that’s why i’m using torso.

I just wanna know how to make the y value for the cframe to be flat and straight.

Try this

local X,Y,Z = Torso.CFrame:ToOrientation()
modelclone:SetPrimaryPartCFrame(CFrame.new(Torso.Position) * CFrame.Angles(0, Y, 0))

1 Like

Thanks it worked! But for some reason, shift lock is kinda weird and doesnt work but if you stay still it does work and I guess its fine for now. But I just want to know why it doesn’t go to shift lock place.
https://gyazo.com/61176198aba11e30cabc4931c36d0234

I think it’s the idle animation, try using the Head or the HumanoidRootPart, or adjust to create the radius moments before the idle animation

image
image

Or should I use humanoidrootpart? would that work? and when I use shift lock, it usually delays and doesnt go forward based on the shift lock direction.

I fixed it with using camera CF