Hi, I’m encountering an issue when trying to connect two parts using a Motor6D
. In my code, I set C1
to have a specific orientation (90, -90, 0)
. However, when running the game, the properties of the Motor6D
display a different orientation.
Below is the relevant code block:
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then
return
end
if input.KeyCode == Enum.KeyCode.F then
if not CurrentItemSelected then return end
local ItemModule = GunsModule[CurrentItemSelected.Name]
local PATH_MODEL:Model = ItemModule.PATH_MODEL:Clone() -- This is a model
PATH_MODEL.Parent = ViewModel
local Part0 = ViewModel:FindFirstChild("Right Arm")
local HandleMotor6D = Instance.new("Motor6D")
HandleMotor6D.Parent = Part0
HandleMotor6D.Name = "Handle"
HandleMotor6D.Part0 = Part0
HandleMotor6D.Part1 = PATH_MODEL.PrimaryPart.Handle
HandleMotor6D.C0 = CFrame.new(Part0:FindFirstChild("AttachArm").Position)
HandleMotor6D.C1 = CFrame.Angles(math.rad(90), math.rad(-90), math.rad(0))
CurrentItemSelected:Destroy()
CurrentItemSelected = nil
end
end)
When running the game, these are the properties generated for the Motor6D
. The issue lies in the orientation of the C1
attribute:
Key Details:
-
Purpose of the Code: This script creates a
Motor6D
to connect a cloned model (PATH_MODEL
) to theViewModel
. -
C1 Configuration: I’m using
CFrame.Angles
with values(90, -90, 0)
to set the desired orientation. -
Unexpected Behavior: Despite configuring
C1
, the orientation shown in the game is different from what I set.
Questions and Context:
- Am I setting
C1
incorrectly? - Could the relative position between
Part0
andPart1
be altering the orientation? - Is there any additional transformation required to make
C1
work as intended?
I’d appreciate any guidance or solutions to this issue. Please let me know if you need more details.