Hey there! As I was implementing how I would rotate models in my placement system, I came into an issue where the model would not rotate based on the Mouse’s position, but around it. The expected behavior is that the model would rotate in place and not affect its position based on the rotation. Any help on this matter is greatly appreciated, thanks!
*The red dot represents the mouse pointer’s position
local xIncrement = 1
local zIncrement = 1
local yIncrement = 1
local yOrientation = 0
--
--Rotate on rBind
local function updateY(actionName, inputState, inputObject)
if actionName == "Rotate" and inputState == Enum.UserInputState.Begin then
yOrientation += yIncrement
end
end
--
local angles = CFrame.Angles(0, yOrientation, 0)
local cframe = CFrame.new(snapPos(raycast.Position.X, xIncrement), raycast.Position.Y + ghost.PrimaryPart.Size.Y/2, snapPos(raycast.Position.Z, zIncrement))
ghost:PivotTo(angles*cframe)
Please let me know if you’d like to see the full code, as this is the only snippet of code I see relevant to the issue at hand.
Said unexpected behavior:
https://medal.tv/games/roblox/clips/vUjSCcoAbWeGN/d1337LfuYjDb?invite=cr-MSxucmYsNzAwMzI4NjEs