even when i get the cameras x,y,z with ToOrientation() and try to use them in a orientation with a vector3.new() it wont work even in math.deg() it just rotates super fast and moves into the ground
Have you tried using the LookAt feature of CFrame?
-- if "cam" is a Camera, use CFrame.Position, otherwise just cam.Position
local targetCFrame = CFrame.new(cam.CFrame.Position, target.Position)
local tween = TweenService:Create(ViewModel.PrimaryPart, vmInfo, {CFrame = targetCFrame})
tween:Play()
You can also provide more code or explanation for further assistance.
In the code you have provided, the * CFrame.Angles(0,0,0) does nothing, so that can be removed, as for the CFrame.new(0,-1.5,0), it moves the same distance no matter the frametime and fps, which is not idea, you can change it to CFrame.new(0,-1.5*60*dt,0). dt being delta time, the time between frames. At 60 fps, it is 1/60
As for answering the title, if you want to tween the rotation, and not change the position, you’d have to do something like this (it would have to be repeated every time the tween ends)
local targetCFrame = ViewModel.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(180),0) -- Can't do 360 in one go, it just wont rotate
local tween = TweenService:Create(ViewModel.PrimaryPart, vmInfo, {CFrame = targetCFrame})
tween:Play()
Or, without using TweenService
local ROTATION_SPEED = math.rad(30) -- 30° per second
local initialCFrame = ViewModel.PrimaryPart.CFrame
RunService.RenderStepped:Conncect(function()
ViewModel.PrimaryPart.CFrame = initialCFrame * CFrame.Angles(0,ROTATION_SPEED*os.clock(),0)
end)
os.clock() can be replaced with tick(), or time(), or whatever. By using Unix time, this replaces the need to use delta time