Roblox changed align orientation so now they have different properties. When i want NPC to look at me it rotates in the wrong direction.
script.Parent.HumanoidRootPart.AlignOrientation.CFrame=CFrame.new(self.HumanoidRootPart.Position, workspace.target.Position)
All i want is to understand how to use 1 attachment mode to rotate the NPC on the Y axis(like a spinner) without rotating on other axis, as it looks at the player on the horizintal view.
1 Like
I’m pretty sure CFrame
aligns the constraint in relation to Attachment0
, not define where to align the orientation. Instead, you should use LookAtPosition
. To keep the NPC from rotating on axes other than the y-axis, you can just input Attachment0
’s y position components (effectively the constraint’s y position component) and the x and z position components of where the NPC needs to look at (in this case, workspace.Target.Position
).
In other words, I’d rewrite your line to
local constraint = script.Parent.HumanoidRootPart.AlignOrientation
local constPos = constraint.Attachment0.Position
local targetPos = workspace.target.Position
constraint.LookAtPosition = Vector3.new(targetPos.X, constPos.Y, targetPos.X)
1 Like
But i have an animation that rotates the character body(not the humanoid root part) and i want it to always face it relative to the upper torso(like humanoid rotates to a direction that the upper torso looks at the target),
Then make the animation shift the entire body to be offset from the NPC’s character in such a way that the torso is aligned with the NPC’s character, but the legs are not. Perhaps by just rotating the hips and legs in the opposite direction.
Its not working, the align orientation doesnt rotate at all