It would be superb if the RodConstraint had an angle limit akin to two BallSocketConstraints paired together, that way you can eliminate the part that goes between the cars if you don’t need any visual indicator of such a connection.
I had some trouble designing a truck with a trailer. I connected the two using a rod constraint (I also used a rope) but when I turned my car, despite their being ‘tension’ in the rod, the trailers momentum did not change and it carried on moving in the direction it was already until it physically couldn’t and had to adjust to follow the car.
You want a BallSocketConstraint for trailers. If the trailer is articulated (it has no wheels at the front), connect the trailer chassis to the tractor with a single BallSocketConstraint. If the trailer is not articulated (like you see with doubles, and your post suggested with the Rope/RodConstraint) then you need two Hinges/HingeConstraints in addition to the BallSocketConstraint. One of them is so the wheels can pivot on the vertical axis, and the other is so that the connection linkage can rotate up and down as it is connected to the rotating wheels. The connection linkage is connected with a BallSocketConstraint at the tractor. Here’s a picture of a real trailer like this:
You can see the front wheels are turned, and the connection linkage is rotated so it is resting on the ground.
The example place requires 4wd on a hill which is not available with keyboard controls?
And I made a cape…
Unfortunately, I can’t set a limit to the hinges (you know, so the cape doesn’t go through me) without being able to spawn.
Here is my code (for a script in Workspace or ServerScriptService):
local function CharacterAdded(Character)
if Character then
local Torso = Character:WaitForChild("Torso")
local TorsoAttachment = Instance.new("Attachment")
TorsoAttachment.CFrame = CFrame.new(0,1,0.55)
TorsoAttachment.Parent = Torso
local Parts = {}
for i = 1, 8 do
local Part = Instance.new("Part")
Part.BrickColor = BrickColor.new("Bright red")
Part.Material = "SmoothPlastic"
Part.CanCollide = false
Part.Size = Vector3.new(2,0.4,0.2)
Part.TopSurface = "Smooth"
Part.BottomSurface = "Smooth"
Part.Parent = Character
local Mesh = Instance.new("BlockMesh")
Mesh.Scale = Vector3.new(1,1,0.2)
Mesh.Parent = Part
local Attachment1 = Instance.new("Attachment")
Attachment1.CFrame = CFrame.new(0,0.2,0)
Attachment1.Parent = Part
local Attachment2 = Instance.new("Attachment")
Attachment2.CFrame = CFrame.new(0,-0.2,0)
Attachment2.Parent = Part
table.insert(Parts,{Attachment1,Attachment2})
end
local function Attach(Attachment1,Attachment2)
local HingeConstraint = Instance.new("HingeConstraint")
HingeConstraint.Attachment0 = Attachment1
HingeConstraint.Attachment1 = Attachment2
HingeConstraint.LimitsEnabled = true
HingeConstraint.Parent = Attachment1.Parent
return HingeConstraint
end
for i = 1, #Parts do
local Table1,Table2 = Parts[i],Parts[i+1]
if Table1 and Table2 then
local AttachmentPart1 = Table1[2]
local AttachmentPart2 = Table2[1]
Attach(AttachmentPart1,AttachmentPart2)
end
end
local TorsoHingeConstraint = Attach(TorsoAttachment,Parts[1][1])
TorsoHingeConstraint.UpperAngle = -5
end
end
local function PlayerAdded(Player)
if Player then
Player.CharacterAdded:connect(CharacterAdded)
CharacterAdded(Player.Character)
end
end
game.Players.PlayerAdded:connect(PlayerAdded)
for _,Player in pairs(game.Players:GetPlayers()) do
spawn(function() PlayerAdded(Player) end)
end
Are those supposed to be gifs? Neither plays.
Nope, not gifs. Second image has nothing to show as the player never spawns.
Yes sorry I’ve built the buggy with the controller in mind…
Good idea. We might implement the angular limits on rods for next release
For the angular limits on hinges you have to correctly set your secondary axis (y-axis). The limit constraints the angle between the secondary axes of the two attachments
Do have a working version of the code in that case? I am not sure why that would cause my player to not be able to spawn.
The problem might be that your limits cause the system to be over-constrained (which causes the character to vibrate and sends it into inter galactic space). Try disabling collisions on your parts see if that leaves your character intact.
The parts are already CanCollide = false
I have a ragdoll that uses BallSocketConstraints. Could we get a parameter to limit how far the joint can spin? Right now my head (and other parts) can spin completely backwards.
Yes we will have a second cone constraint on ball sockets in a future release. Could you use a hinge with angular limits instead?
I remade the dune buggy that you made @chefdeletat
Took me awhile to get it working in a satisfactory manner, but I’m pretty happy with it.
It can navigate very bumpy terrain with relative ease, as long as its not too steep.
anyone else notice that “THEME OPTIONS” in the top right corner? hmm
Anyone else having trouble with Servo hinges? No matter what I set the torque, angular velocity or desired angle to, it just rotates slightly then stops.