Where could I start with making a movement system similar to this:
When holding the gun the player kind of acts like its in shift lock.
Where could I start with making a movement system similar to this:
When holding the gun the player kind of acts like its in shift lock.
you’d either have to code your own shiftlock, or fork over the PlayerModule script and make shiftlock based on some external value so you can activate it once you equip a gun
I prefer this, I want to know where to start or what property’s I should be dealing with.
im not entirely sure how roblox’es shiftlock works, but theres two things you can do to mimic it. either constantly CFrame the RootPart of your rig on the Y axis to match the camera’s, or you can use an AlignOrientation/BodyGyro to rotate the RootPart to match the Y axis of the camera.
I tried those methods a while ago, they appear very unstable and jittery.
it depends on how its executed, BodyGyros/AlignOrientations need to be tweaked through their properties to make sure they apply the right amount of force, too little and it is slow and unresponsive, and too much force makes it jittery and unstable.
CFraming the RootPart will only be jittery if you do not fire every single RenderStepped cycle. also, you have to make sure you retain the position on that physics frame and make sure its X and Z rotation don’t get altered, only the Y axis.
either way to get the CFrame you want, it’d be something like this:
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local runServ = game:GetService("RunService")
runServ.RenderStepped:connect(function()
if player.Character and player.Character:FindFirstChild"HumanoidRootPart" then
local rootCFrame = player.Character.HumanoidRootPart.CFrame
local camXRot, camYRot = camera.CFrame:ToOrientation()
local rootXRot, rootYRot, rootZRot = rootCFrame:ToOrientation()
local finalRootCFrame = CFrame.new(rootCFrame.p) * CFrame.Angles(rootXRot, camYRot, rootZRot)
end
end)
No need for wat other guy said. Just edit the humanoids cameraoffset and lock the mouse, that’s how the roblox one does it.
doing that mimics shiftlock in appearance but you don’t get the rotation of shiftlock.
you also have to make the player face the mouse,
here’s a reply that should help:
This looks like it could be this resource, which is a great & quick resource for simple over the shoulder (shift-lock) systems.