I'm trying to make my AI shooter face the enemy target in a smoother rotational transition; though it won't tween since it's not anchored and I need it anchored in order for the tween to work. I tried doing unanchored torso and anchored torso repeatedly, but it's really inefficient.
So is there a way to tween a part without it being anchored?
If impossible, then is there something else other than tweening?
BodyMovers allow for the smooth movement and rotation of unanchored parts. They use Roblox physics and include various properties that influence how they move. If you wanted to make an object/model face a specific point, I would recommend BodyGyro. When you set the CFrame property of this BodyMover, it will rotate its parent to adopt the orientation of the CFrame given.
For example, if you wanted to make a humanoid model rotate to constantly face a part called FacePart in workspace, you could do something like this in a script inside the model:
local Model = script.Parent local Target = workspace.FacePart local BG = Instance.new("BodyGyro") BG.MaxTorque = Vector3.new(0,math.huge,0) BG.Parent = Model.HumanoidRootPart game:GetService("RunService").Stepped:Connect(function() local DesiredCFrame = CFrame.new(Model.HumanoidRootPart.Position, Target.Position) BG.CFrame = DesiredCFrame end)
The MaxTorque of BodyGyros controls which axes the gyro can apply force to. Since in the script it is only set on the Y-axis, it will only control the "swivelling" of the model.
Hope this helps!
This looks like a job for BodyGyro!
It will allow you to apply a rotational force to an object to keep it oriented in a specific manner.
Hope this helps! :)