My target is it: That the HumanoidRootPart should look at the direction where I raycasted and not with! CFrame.new(position, lookAt) because then this happen:
If you want test it out then just do an Input then test it by urself.
Please just write the edit in the comment and if you need the game link pls write to me privat I will send to you and if you solved privat I will make you comment here solved.
Then I think you’re doing something wrong, because that should be the solution. But it shouldn’t matter anyways since the ray is created based on where you are already facing.
It seems like you want the Character to face in the direction of the surface normal.
You can access it like so:
local rayCast = workspace:Raycast(...)
local normalVector = rayCast.Normal
Of course, since the normal can point upwards and downwards, you want to avoid having your character tilting up and down. You can simply remove the Y component.
Yes, you can do RaycastResult.Normal to get the normal, the vector will be the surface normal of the object it hits, which is a direction pointing away from the wall depending on where the raycast hits it.