I’m trying to get multiple “beams” to point at one object with Motor6Ds. I have two Motor6Ds (tilt, pan).

I’m not really sure on how or where to start. Is it possible to do with DesiredAngle?

I dont know anything specific but you could probably solve for the angle using trigonometry with the location of the thing you want to point towards and the location of the thing you are pointing

I don’t really know anything about trigonometry for roblox. Here’s another example of what I need.

Try messing with the values of the `AxisAngle`

functions of CFrame. Those functions use some trigonometry functions internally and they are simple to use for beginners.

However, they will be quite slow. The 2nd example you sent does not use Motor6Ds and uses AlignOrientation instead, which is way faster (but less stable).

I know nothing about cframes and stuff. I want to keep everything in a motor6d

just use CFrame.new(Vector3Positionofyourlight, Vector3positionofcharacter or point to look at)

this will set the Cframe of the light to point at the character if the lookvector is correct

use this with a tween setting cframe*

That won’t work because there’s a head “tilt, y” and arm “pan, x”.

I cant just make the head spin the wrong way.

You’ll need to know how to calculate the desired angle of the Motor6D. The angle properties of a Motor are in radians, so this shouldn’t be too hard.

Well, I’m not good at actually coding all of that math and I don’t have a need to find out right now, so if you manage to get it to point at something correctly, that’s great, and I can help you from there.

I got it to somewhat work but if it “crosses its barrier” it just stops following.

Here’s the script I have now

```
while true do
wait()
for i,v in pairs(workspace.NEXUSBEAMS.GROUPA:GetChildren()) do
v.Motors.Pan.DesiredAngle = -CFrame.new(v.Arm.Arm.Position, workspace.FOLLOW.Position).LookVector.X
v.Motors.Tilt.DesiredAngle = -CFrame.new(v.Head.Head.Position, workspace.FOLLOW.Position).LookVector.Y + math.rad(90)
end
for i,v in pairs(workspace.NEXUSBEAMS.GROUPB:GetChildren()) do
v.Motors.Pan.DesiredAngle = CFrame.new(v.Arm.Arm.Position, workspace.FOLLOW.Position).LookVector.X
v.Motors.Tilt.DesiredAngle = CFrame.new(v.Head.Head.Position, workspace.FOLLOW.Position).LookVector.Y + math.rad(90)
end
end
```

Here’s what I mean

It stops following

Like if I go completely under it, it stops working

Can someone please help me? I really need help.

search up IK and you will most likely find what you need

I am looking for the same solution as you, but not allot of people know how to do the maths using motor6D as they are not used in many cases, the EDM Community is complex. This is all I found when looking for help:

lmk if you find anything cos I am not sure either

its been 16 days with no answer. please help

Trigonometry

If its a hinge constraint you can use this function

```
--Function for a hinge constraint
local function calculateServoAngle(hinge : HingeConstraint, targetPosition : Vector3)
local baseAttachment = hinge.Attachment0
local object_horizontal_offset = (baseAttachment.WorldCFrame):PointToObjectSpace(targetPosition)
local object_yaw_angle = math.atan2(object_horizontal_offset.Y, -object_horizontal_offset.Z)
object_yaw_angle = math.deg(object_yaw_angle)
return object_yaw_angle
end
```

```
while true do
wait(0)
for i,v in pairs(workspace.NEXUSBEAMS.GROUPB:GetChildren()) do
if v.Name == "N1T" then
local object_horizontal_offset = v.Base.Base.CFrame:PointToObjectSpace(workspace.Panel.Position)
local object_yaw_angle = math.atan2(-object_horizontal_offset.X, -object_horizontal_offset.Z)
local object_yaw_angsle = math.atan2(object_horizontal_offset.X, object_horizontal_offset.Y)
--Yaw angle is the goal CFrame
--Next is PID stuff which I believe you are not concerned with
--yawBase is the base of the turret.
--I heavily suggest experimentation by printing out the values or
--some other value monitoring method to make sure you get the right angle
v.Motors.Pan.DesiredAngle = object_yaw_angle + math.rad(90)
v.Motors.Tilt.DesiredAngle = object_yaw_angsle + math.rad(90)
end
end
end
```

This is what I got so far. But Tilting does not work properly.

Can someone help me? I need help quick

its been 5 days no help. Please soneone help

Why exactly do you need to use a Motor6D and not a weld or AlignOrientation?