You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Making a NPC rotate purely in it’s center no movement. -
What is the issue? Include screenshots / videos if possible!
Rotating on the Y axis works fine, when rotating on the X it begins to move forward and backward weirdly.
Rotation should not be affecting his position at all? -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried using euler angles, rotation order etc, even subtracting prevx and prevy and such.
Here’s my current code, I just want to emphasize that the rotation should just be affecting his rotation, not his position but for some reason it affects his position??
function wobbleEffect()
local startCF = SCP.PrimaryPart.CFrame
local start = tick()
local prevY = 0
local prevX = 0
runService.Heartbeat:Connect(function(deltaTime)
local time = tick() --tick() - start
local sineY = math.sin(time * 2) * 2.5
local sineX = math.sin(time * .5) * 1.5
startCF = CFrame.new(humanoidRootPart.Position) * startCF.Rotation
SCP:PivotTo(startCF * CFrame.Angles(math.rad(sineX), math.rad(sineY), 0))
end)
end
Yes I can see that I added startCF = cframe.new hum position, but in the first place the rotation should not even be affecting the position, is there any workaround while still allowing said NPC to be moved by physics?