Made the character look where the camera looks... but there is a problem

np… oversights happen :grinning:
(30CHARLIMITWHY)

1 Like

Going to sleep.
If i don’t respond… that’s why.

Alright. I’m still trying to figure this out; however, I’m not necessarily an expert with CFrames. I got this to work, though:

Here’s a function tuned to your needs.

--Initialization
local torso = script.Parent:WaitForChild"UpperTorso" 
local humanoidRootPart = script.Parent:WaitForChild"HumanoidRootPart"

local OrigC0 = torso.Waist.C0 --store the original C0 value for transformation

--"Runtime"

function answears(plr,look)
	local torsoL = humanoidRootPart.CFrame.LookVector
	local torsoR = humanoidRootPart.CFrame.RightVector
	local torsoU = humanoidRootPart.CFrame.UpVector
	--Just the basic vectors, you can tell what they are already.
	local camVect = look:Lerp(humanoidRootPart.CFrame.LookVector,0.51)
	--Make a vector that doesn't turn you like that girl from the exorcist
	
	local rotY = -math.atan2(torsoR:Dot(camVect),torsoL:Dot(camVect))
	--Dot determines how much the target vect faces the torso vectors
	--By doing this, we can construct "relative" coordinates as opposed to "absolute" coordinates.
	--We can then determine the relative angle from these coordinates using atan2
	
	local rotX =  math.asin(torsoU:Dot(camVect))*2
	--This also works the same, only this time it's for getting the rotation looking up/down
	
	torso.Waist.C0 =  OrigC0*CFrame.Angles(0,rotY,0)*CFrame.Angles(rotX,0,0)
	--Sets the waist every step
end

--You could realistically compact this entire function into a couple of lines, but this is just easier to read.
ans.OnServerEvent:Connect(answears)

Adjusting the joints of a motor for the sake of facing something should definitely be a relative value.

2 Likes

Funnily enough, I actually just remembered toObjectSpace exists, and fixed the whole thing. Can’t believe it took me this long.
Baseplate (1).rbxl (19.3 KB)
Your solution looks like it’d also work just as fine, figured I’d post mine though. Added client side lerping and all that fancy stuff.

5 Likes

Allrigh.
@MrMauio @pheonixmario
Let me wake up first, and i’ll try them and see what works best for me, and then i’ll mark the solution.

:laughing:

1 Like

So the results:

@pheonixmario’s solution broke when trying to port to final product, but still smooth.

So i wanted it to come down to readability and ease of use… then this happened.

So thx again for the help… if you need credit, tell me. I am more than willing to give credit. I’m glad people are out to help, and thank you for your time.

edit: hitfilm (video editor) messed up the quality.

1 Like

I don’t need any credit, just happy that it works :slight_smile:

3 Likes