Say I have this wedge here:
What cframe properties should I access so I can spawn a part at the wedge’s position, AND have it face the same direction as the sloped face? Like so:
I’ve tried messing around with the cframe look vector, but it just produces the same results again and again. What should I do here?
Moonvane
(Moonvane)
#2
this will work regardless of the orientation of the wedge:
local wedge = workspace.Wedge
local partToRotate = workspace.Part
local ang = math.atan2(wedge.Size.Z, wedge.Size.Y)
partToRotate.CFrame = wedge.CFrame * CFrame.Angles(ang, 0, 0) * CFrame.new(0, 0, -5)
Solved. I set the part I wanted to spawn’s cframe to the cframe of the spawn position times the orientation of the wedge piece.
local car_cframe = CFrame.new(VECTOR OF WHERE TO SPAWN MODEL) * CFrame.Angles(0, math.rad(ROTATION OF THE WEDGE PIECE), 0)