Hello Developers!
I’m currently making a car system but having troubles setting up cylindrical attachments within my script. Every cylindrical gets attached correctly but the positioning and orientation does not look correct and I do not know how to fix this issue. I have provided below two images one is what it is meant to look like and another is what it looks like when generated from a script.
for i, v in pairs(Car.Wheels:GetChildren()) do
local Axis = Car.Axises["Axle".. string.sub(v.Name, 6)]
local Cylindrical = Instance.new("CylindricalConstraint")
local AttachmentAxis = Instance.new("Attachment")
local AttachmentWheel = Instance.new("Attachment")
AttachmentAxis.Parent = Axis
AttachmentWheel.Parent = v
if string.sub(v.Name, 7) == "R" then
AttachmentAxis.Position = Vector3.new(0, 0, Axis.Size.Z/2)
AttachmentWheel.Position = Vector3.new(v.Size.X/2, 0, 0)
else
AttachmentAxis.Position = Vector3.new(0, 0, -Axis.Size.Z/2)
AttachmentWheel.Position = Vector3.new(-v.Size.X/2, 0, 0)
end
Cylindrical.Parent = v
Cylindrical.Attachment0 = AttachmentWheel
Cylindrical.Attachment1 = AttachmentAxis
Cylindrical.AngularActuatorType = Enum.ActuatorType.Motor
Cylindrical.InclinationAngle = 90
Cylindrical.LimitsEnabled = true
Cylindrical.LowerLimit = -1
Cylindrical.UpperLimit = 1
end
Manual (Correct):
Generated (Incorrect):

