The direction value is either 1 or -1 depending on whether the player’s facing left or right. Getting the unit is not necessary
So, this is how it should look: ``plr.Character:SetPrimaryPartCFrame(CFrame.new(HRT.Position, Direction.Unit)
It doesn’t really matter. But I guess you are right.
oh its simple. To change a parts cframe rotation just do part.CFrame = part.CFrame * CFrame.Angles(math.rad(90), math.rad(90), math.rad(90))
. This would rotate the part to 90 degrees on each axix. It is very important to use math.rad as it converts the degrees to radions so the cframe can be changed by inputting degress instead of having to do the math to get the radians.
You could also do
CFrame.new(character.Position) * CFrame.Angles()
for non-relative rotations
My idea is just do this: HRP.CFrame = CFrame.new(HRP.Position, Direction)
I’ll give it a shot, one second.
true but in this case I think relative orientation is needed
You could make a new part, make it invisible, and set can collide to false, keep anchored to true and set the cframe to the frame of the hmr, then set the orientation of the character to the orientation of the part
that seems a bit redudant. Why would set a parts position when you can just set the HRP directly
Still snappy, It’s not a problem with the cframe math, it just does not update at the same render cycle, I’ll try binding it to render step and i’ll see what happens.
oh yah definantly use render stepped to reduce lag and jumpy changes to the cframe
A second option is to actually using tweening and tween the players HRP to the mouse’s direction so it is smooth and doesnt mess up the camera by snapping.
You may be able to edit the C0 on the RootJoint in order to simulate the effect without actually moving the character around.
Tweening’s a bad idea, I’m trying to instantly update the CFrame, the snappiness occurs because the position and cframe dont match up. I’ve tried to bind it to renderstep via an anonymous function however, that doesn’t work
Oh that’s true, where’s this rootjoint found? in the HRP?
The root joint is found in the LowerTorso
Gotcha, and how exactly would i implement it? since i know the “position” will be altered also?
local HRT = plr.Character.HumanoidRootPart
local Direction = HRT.Position + Vector3.new(Direction,0,0)
local Orientation = CFrame.new(HRT.Position, Direction) - HRT.Position
LowerTorso:WaitForChild("Root").C0 = Orientation
This is what I got
local x, y, z = HRP.CFrame:ToEulerAnglesYXZ()
Rootjoint.C0 = CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(90) - y, 0)
That worked! Thank you so much for the help