#how do i make something face where the player faces

1 messages · Page 1 of 1 (latest)

royal umbra
#

got a gun that shoots where your facing but i dont know how to set the rotation of the part to the players lookvector

dusky egret
# royal umbra

If you multiply the CFrame by a Vector, you get the position relative to the CFrame

So try something like hitbox.CFrame = root.CFrame * Vector3.new(0, 0, 3)

royal umbra
#

ill try that

dusky egret
royal umbra
#

yeah

dusky egret
# royal umbra yeah

In that case, you need to make a new CFrame with the hitbox's position (which means the angles will be 0) then multiply it by the root's CFrame.Rotation, which is the CFrame with only the rotation

royal umbra
#

ok

#

wdym make a new cframe?

#

edit the cframe of the part?

#

actually i think i get it

#

multiply parts rotation by the roots rotation

dusky egret
# royal umbra multiply parts rotation by the roots rotation

Well

CFrame.new(hitbox.CFrame.Position) makes a new CFrame with no rotation.

root.CFrame.Rotation is the root's CFrame with no position, just rotation

So multiplying those makes a CFrame with the hitbox's position, but the root's rotation

royal umbra
#

ok

#

``lua

#

    hitbox.Position = root.Position + root.CFrame.lookVector * 1.4
                        CFrame.new(hitbox.CFrame.Position) 
                        print(hitbox.CFrame.Rotation)
                      hitbox.CFrame.Rotation *= root.CFrame.Rotation
royal umbra
#

ok

dusky egret
#

I'd probably calculate the desired hitbox position, then use that to make a new CFrame, multiplying that by the player's CFrame.Rotation

royal umbra
#

ok

#

how do i make something face where the player faces

#

im still struggling

dusky egret
tidal parcelBOT
#

studio** You are now Level 23! **studio

royal umbra
dusky egret
royal umbra
#

yeah maybe not

dusky egret
# royal umbra yeah maybe not

Okay well you can also just set the Orientation of the hitbox to the orientation of the root instead of using CFrames

shadow ocean
#

Just a heads up.

royal umbra
#

and it worked

#

didnt have to read all that cframe stuff]

#

i hate reading i learn through expirimentation

shadow ocean
#

Experiment with reading.