How to use motor6 engines to point arms at the camera's direction using r6 characters

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    use r6 motors to point characters arms at the camera with r6 characters

  2. What is the issue? Include screenshots / videos if possible!


  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    everyone tutorial I’ve seen so far uses r15 and it works for that but I don’t know how to translate it over to r6
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local cam = workspace.CurrentCamera

local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()
local torso = char:WaitForChild("Torso")
local rightShoulder = torso:FindFirstChild("Right Shoulder", true)

local y = rightShoulder.C1.Y



while wait(1) do
	if rightShoulder then

		local camDirection = torso.CFrame:ToObjectSpace(cam.CFrame).LookVector
	
		rightShoulder.C1 = CFrame.new(-0.5, 0.5, 0)
		rightShoulder.C1 = CFrame.fromOrientation(0, 90, -camDirection.Y)
	end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

3 Likes

also the motors wont keep the orientations i give them

1 Like
local cam = workspace.CurrentCamera

local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()
local torso = char:WaitForChild("HumanoidRootPart")
local rightShoulder = torso:FindFirstChild("Right Shoulder", true)

local C0Off = rightShoulder.C0

while wait(1) do
	if rightShoulder then

		local camcf = CFrame.new(torso.Position,cam.CFrame)
	
		rightShoulder.C0 = C0Off*camcf
	end
end

try this?

2 Likes
local cam = workspace.CurrentCamera

local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()
local torso = char:WaitForChild("Torso")
local rightShoulder = torso:FindFirstChild("Right Shoulder", true)

local C0Off = rightShoulder.C0

while wait(1) do
	if rightShoulder then

		local camcf = CFrame.new(torso.Position,cam.CFrame)

		rightShoulder.C0 = C0Off*camcf
	end
end

wants a vector not a cframe, also had to change the humanoidrootpart to torso because the torso is the one with the shoulder motor

1 Like
local cam = workspace.CurrentCamera

local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()
local torso = char:WaitForChild("Torso")
local rightShoulder = torso:FindFirstChild("Right Shoulder", true)

local C0Off = rightShoulder.C0

while wait(1) do
	if rightShoulder then

		local camcf = CFrame.new(torso.Position,cam.CFrame.Position) -- forgot to make it a vector3 mb

		rightShoulder.C0 = C0Off*camcf
	end
end
1 Like

i think ur multiplying the position of it rather than the orientation/angle

1 Like
local olneckc0 = Neck.C0-Vector3.new(0,1,0)
Neck.C0 = NPC.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(NPC.HumanoidRootPart.Position+Vector3.new(0,1,0),Char.Head.Position))*olneckc0

reverse engineer this. i cant cuz rn i am very busy sorry.

1 Like

When using C1, you use :Inverse(), which is the Inverse of a CFrame, when Applying Rotations, you use Radians Instead of Degree’s, which 90 degrees should be equivilent to math.pi/2 or math.pi*.5

C0 and C1 are applied in Object Space, meaning their Positions are Relative to Something.
C0 is Relative to Part0, C1 is Relative to Part1.

If you have a Position of 100,100,100, with a Part that is 50,50,50, The Position Transformed to Object Space would be 50, 50, 50 as the difference of 100 - 50 is 50, but in world space its 100, 100, 100

If you Apply World Space onto a Property that uses Object Space, it will apply it based on Object Space, which you use :ToObjectSpace() to Transform the CFrame, or you can use b:Inverse() * a with is the same as b - a

1 Like

so am I applying this to the C1 or should I switch to C0
your explanation was perfect but I’m confused on how to apply it to the code
edit: if u can tell me how to do that it would be good, but if not i should be able to figure it out on my own with how u explained it

1 Like

Use C0 its most preferred.