if source:FindFirstChild("Head") and source.Head:FindFirstChild("Neck") then
if endingHeadRotation == true then
repeat
runService.Heartbeat:Wait()
until endingHeadRotation == false or interaction.Value ~= source
if interaction.Value ~= source then
return
end
end
local neck = source.Head.Neck
local NPC = source
local cframe0 = neck.C0
repeat
runService.Heartbeat:Wait()
local is_in_front = NPC.Head.CFrame:ToObjectSpace(char.Head.CFrame).Z < -0.8
if is_in_front and endingHeadRotation == false then
local unit = -(NPC.Head.CFrame.p - char.Head.Position).unit
local tween = tweenService:Create(neck,TweenInfo.new(0.5),{C0 = cframe0 * CFrame.new(Vector3.new(0, 0, 0), unit)})
tween:Play()
end
until interaction.Value ~= source or dead
endingHeadRotation = true
local tween = tweenService:Create(neck,TweenInfo.new(0.5),{C0 = cframe0})
tween:Play()
task.wait(0.5)
endingHeadRotation = false
end
How can I make it take into account the head position based on animations? All help is greatly appreciated thanks in advance!
Animations are applied in a motor6ds .Transform. Here are some ideas you can do:
So you can either set it to CFrame.new() on .Stepped as recommended by the documentation to cancel the animations.
Or you can try to add an Transform:Inverse() on the C0 to cancel out the transform animation.
Another idea is if you still want the effect of animations you can :Lerp() it with CFrame.new() to reduce the amount of rotations applied in the .Transform.
Still having this issue a week later with no solution found yet. Would an align orientation fix this issue? I’m unsure if an align orientation would even work on a rigged head to begin with.
Don’t know the code for it but you want to take into account the head relative to the torso/upper torso. Here is a video that shows you how to do it:
R15:
R6 Functionality + Replication:
Not sure if you’ll need the replication but if you’re R15, watch the first video. If you’re R6, watch the first then the second because it builds off the first.
Would this take into account the head being rotated by animations? Offsetting by the upper torso would definitely improve the head rotations but im unsure if this would fix the problem altogether.
As stated here, you can do this to essentially get rid of head animations. I’m not entirely sure what you mean. You either:
You want the head to face the direction and if the animation makes the head look right, the head won’t look away. You can fix this by doing what’s listed above by dthecoolest.
You want the head to face the direction and if your character (upper torso) gets rotated by an animation, the head will accommodate for this change. This can be fixed with my response above.