Wheels spin in the wrong direction

-- wheel A
	local WA = Instance.new("Attachment")
	WA.Parent = wheel
	WA.Orientation = Vector3.new(0, 0, 90)

	WA.Name = "RA"

-- root A
local RA = Instance.new("Attachment")
	RA.Parent = root
	
	RA.Position = Vector3.new(root.CFrame:ToObjectSpace(wheel.CFrame).Position.X, root.Size.Y/-2, root.CFrame:ToObjectSpace(wheel.CFrame).Position.Z)
	RA.Orientation = Vector3.new(0, 0, 90)
	

-- HP
	RA.Name = "A" .. wheel.Name
local HP = Instance.new("Part")
	HP.Size = Vector3.new(1, 1, 1)
	HP.CFrame = CFrame.new(RA.WorldPosition.X/2, wheel.Position.Y, RA.WorldPosition.Z)
	
	HP.CustomPhysicalProperties = wheel.CurrentPhysicalProperties
	HP.Transparency = 1
	HP.CanCollide = false
	
	HP.Name = "HP"
	HP.Parent = wheel
	
	local HPA = Instance.new("Attachment")
	HPA.Orientation = Vector3.new(0, 90, 0)
	
	HPA.Name = "HPA"
	HPA.Parent = HP

-- suspension constraint
	local constraint = Instance.new("PrismaticConstraint")
	constraint.Attachment0 = HPA
	constraint.Attachment1 = RA
	
	constraint.LimitsEnabled = true
	constraint.LowerLimit = tune.susminlength
	constraint.UpperLimit = tune.susmaxlength
	
	constraint.Parent = wheel
	constraint.Visible = tune.debug
	constraint.Name = "C" .. wheel.Name

-- engine
	local M = Instance.new("HingeConstraint")
	M.Attachment0 = HPA
	M.Attachment1 = WA
	
	M.ActuatorType = Enum.ActuatorType.Motor
	M.MotorMaxTorque = tune.gears[1]
	M.MotorMaxAcceleration = math.huge
	
	M.Name = "M"
	M.Parent = HP

As you can clearly see, the wheels spin in the wrong direction. I honestly have no idea how to fix this.

Try messing around with the orientations of the attachments. It’s likely that you have some combination of orientations that causes it to spin that way.

I’ve tried.
image
This is how I ended up changing them so the wheel stayed in the right direction, however the motor spins the wheel the same way as the 90 you can see below the base.

I’d change the orientation of the RA attachment
I can’t tell which direction is which from your picture, but once I think it would be either (0,0,180) or (90, 0, 90)

I’ve removed each line which changed the orientation of the attachments and then I have rotated them myself in studio. Maybe this helps.

first, adjust Attachment0 so that the hinge faces the correct direction
then, adjust Attachment1 so that the wheel faces the correct direction

Yeah- that’s what I’m asking help for. How?

first, change the orientation of Attachment0 so that when you select the hinge constraint, it shows that it rotates in the correct direction. ignore how the wheel part looks during this
image

then, change the orientation of Attachment1 so that the Part attached to the constraint, Part1, the wheel, is facing the correct direction

Both of them face the correct direction already
image
But the PrismaticConstraint is sideways. I’ve tried fixing this by setting the wheel’s respective attachment to 0, 0, 90
image
But that messes up the orientation of the wheel itself.
image
I’ve then tried to set the wheel’s attachment (RA/Attachment1/WA) to 0, -90, 0
image
But the motor did not rotate with it as you can see by that blue circular arrow, which causes it to spin in the wrong direction.

since you’re using both a hinge constraint and a prismatic constraint, you might want to swap to just using a cylindrical constraint instead

but if you want to keep using these two constraints, you could use a different pair of attachments for each of the constraints since they can’t have attachments with the same orientation as each other

The PrismaticConstraint is for the suspension. CylindricalConstraint doesn’t help.
I don’t really understand what you mean by having a different pair of attachments. Here’s how I made them.

HP is a part which connects the wheel and car together. It sits right next to the wheel and has the PrismaticConstraint connected to it, so it isn’t disconnected from the car. HP has its own Attachment with my Motor which uses the wheel’s attachment and HP’s attachment. HP’s abbrevation is literally HingePart.

The problem is that the PrismaticConstraint restricts movement in the wrong direction - sideways. Which means the wheels absorb shock from the walls, not the ground. And I’ve already explained how I tried to prevent this.

ok, start from the root.

  1. makeyour prismatic constraint face the correct direction by rotating its Attachment0
  2. make the part moved by your prismatic constraint face the correct direction by adjusting the prismatic constraint’s Attachment1
  3. make the hinge constraint face the correct direction by adjusting its Attachment0
  4. make the part connect by the hinge constraint, the Wheel, face the correct direction by adjusting the constraint’s Attachment1’s orientation

the prismatic constraint should be correct before you start adjusting the hinge constraint

Nevermind I understand what you meant by a different attachment. I’ve fixed it, thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.