Hello, I would like to do something like that, that when the player looks down the head tilts (as seen in the video) any idea how to get it?
when I try to rotate the player’s torso he dies
Hello, I would like to do something like that, that when the player looks down the head tilts (as seen in the video) any idea how to get it?
when I try to rotate the player’s torso he dies
What are you using to rotate it? I presume you should use CFrames.
I don’t personally know how to do it, but I know if you’re doing it via the Rotation property, it will kill them
Exactly, I tried it that way and the player died … could it be an animation?
I’m not exactly sure. It could be possibly modifying the Motor6D’s properties:
Motor6d API
(possibly the Transform property?)
What do you think about this? it could work? if I want to play an animation when the minimum limit is reached
-- Camera limitations function
local function limitCameraUpDown(minVal, maxVal, isTrue)
if isTrue == true then
RunService:BindToRenderStep("UpdateLoop", Enum.RenderPriority.Camera.Value, function()
local minCameraVal = minVal -- -34
local maxCameraVal = maxVal -- 150
local rX, rY, rZ = camera.CFrame:ToOrientation()
local limX = math.clamp(math.deg(rX), minCameraVal, maxCameraVal)
camera.CFrame = CFrame.new(camera.CFrame.p) * CFrame.fromOrientation(math.rad(limX), rY, rZ)
if minCameraVal then
-- Play bow animation
end
end)
else
warn('limitCameraUpDown is off')
end
end
I don’t have access to my development computer right now, sorry.
Calm down, there’s no problem
By any chance, do you know how I can evaluate if the CFrame of the camera is equal to the minimum value that I have in the function?
local normalCamera = camera.CFrame:ToOrientation()
-- Camera limitations function
local function limitCameraUpDown(minVal, maxVal, isTrue)
if isTrue == true then
RunService:BindToRenderStep("UpdateLoop", Enum.RenderPriority.Camera.Value, function()
local minCameraVal = minVal -- -34
local maxCameraVal = maxVal -- 150
local rX, rY, rZ = camera.CFrame:ToOrientation()
local limX = math.clamp(math.deg(rX), minCameraVal, maxCameraVal)
camera.CFrame = CFrame.new(camera.CFrame.p) * CFrame.fromOrientation(math.rad(limX), rY, rZ)
if camera.CFrame == minCameraVal then
-- Play bow animation
print('playing anim')
else
print('not playing anim')
end
end)
else
warn('limitCameraUpDown is off')
end
end
Try reading this: Making a player's head face a part using a Motor6D
As you’ve experienced when you break the Motor6D weld between the head and the torso the player dies.
but how can I do it if what I want is to do something like:
if camera.CFrame == minCameraVal then -- min val is -34 check script up
-- Play bow animation
print('playing anim')
else
-- Play idle animation
print('not playing anim')
end
I would like to condition between two values, in such a way that it reproduces an animation and in the else to return to idle
The issue here is an animation can’t be controlled to change to look at a certain Part.
The Motor6D | Roblox Creator Documentation can be updated to look wherever you want it to using the CurrentAngle and Motor | Roblox Creator Documentation
Propertiess.