I want to make an cframe where its upsite and not its frontside face to an vector. Thats becouse i want to make an cframe from a raycasts hit.position and the normal as an upvector so a cframe where its upside face the normal vector and not the front vector
I don’t really understand your question, could you explain further?
i want to get a cframe with the orign position from the raycast result and it should loot at with the top to the normal vector from the raycasting result
You can rotate the CFrame. That’s what it says in the documentation, in the “Facing a Specific Surface Toward a Point” section.
local cframe = CFrame.lookAt(hit.position,normal+hit.position)*CFrame.Angles(-math.pi/2,0,0)
nah that dont work for my usecase but I found a way after trying and debunging for a long time.
I done it like this:
CFrame.lookAt(Vector3.zero,hit.Normal,Vector3.new(0,0,1)):ToWorldSpace(CFrame.Angles(math.rad(-90),0,0))