Roblox Rotation Help

How would you create a World Model (Child of a ViewPort Frame) allow a Child (Of WorldModel) which is a Model to be able to rotate to the players mouse. I.E. dragging left would rotate the model in the appropriate direction.

Why has no one ran into this error, I looked across the entire DevForum and found one module being brought up lot’s but it didn’t help me at all because it didnt use World Models and I couldnt understand it. Please help :smiley:

( This is using a local script )

You should orbit the camera instead if its a viewport frame, updating the camera in ViewportFrames is much faster than editing instances inside them due to an optimization. You can take the mouse position relative to the frame and use it to set the camera rotation:

local cameraDistance = 25
local cameraFocus = Vector3.zero
local cameraOffset = CFrame.Angles(mouseRel.Y, mouseRel.X, 0) * (Vector3.zAxis * -cameraDistance)
viewport.CurrentCamera.CFrame = CFrame.lookAt(cameraFocus + cameraOffset, cameraFocus, Vector3.yAxis)
1 Like

Thank you so much for responding I hope this works :smiley: and I hope that it helps people like me who looked arround the devforum for 2 hours+ to find this simple solution. Thank you so much :smiley:

Does this implement User Input though because I need the user to be able to drag arround and view the part by rotating (by dragging). If you could please aid with this too it would be very appreciated :smiley:

(DRAGGING WITH MOUSE)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.