VehicleSeat Constraints

As a Roblox developer, it is currently too hard to build a simple vehicle without the use of hinges/motors or scripts. Constraints are supposed to help us move away from hinges, yet there is no Constraint that works like a hinge. I’d personally like to see a replacement to the hinge in the new constraint features, however, the constraint feature has to automatically work with vehicleseat likes the hinge currently does.

Right now, developers simply need 4 Spheres, 1 Brick, and 1 VehicleSeat with the Vehicleseat Welded to the Brick, and the Spheres attached to the Brick with hinges to make a working car.

With constraints like Springs, it’s possible to make a realistic suspension for vehicles, but the spring constraint does not allow for the wheels to be turned via a vehicle seat without scripting in forces or scripting in parts to rotate themselves.

Because there is no constraint currently that natively speaks to the vehicleseat to be used, many creators, especially in the Ro-Racing Community (myself included) still use hinges which work very weird whether in PGS Enabled environments or PGS Disabled environments.

3 Likes

I support this, but at the same time I have a bunch of vehicles that use scripts connected to the VehicleSeat inputs to drive HingeConstraints set to Motor to drive and steer the vehicle.
If they made VehicleSeats drive Hinges automatically then there would probably be issues with cases where people had already set scripts up to do that kind of thing.

1 Like

True, but then you could just get rid of the script, and boom.

1 Like

Huh?

I meant more in that it does not have all the features that the other Hinge has. I.E. Works with VehicleSeats, in particular.

1 Like

A lot of developers have moved beyond relying on the kind of awful default vehicle seat behavior. It only works server-side for one thing.

It’s really easy to implement a script to replace the functionality you lose by moving to hinge constraints. Here’s the one I wrote for some vehicles in my non-vehicle-based game (it assumes that there’s parts named ‘Wheel’ which have hinge constraints, whose attachments have ‘Left’ or ‘Right’ in the name based on which side of the car they’re on):

	while self.running do
		local throttle = self.seat.ThrottleFloat
		local speed = 10 * throttle
		for _,child in pairs(self.model:GetChildren()) do
			if child.Name == 'Wheel' then
				local f = 1
				if child.HingeConstraint.Attachment0.Name:find("Right") then
					f = -1
				end
				child.HingeConstraint.AngularVelocity = speed * f
				child.HingeConstraint.MotorMaxTorque = 60000
			end
		end
		RunService.Heartbeat:Wait()
	end

I just have this running server side at the moment, but if you set physics ownership of the vehicle to the player driving it then you can run this on the client just fine.

There’s also constraint-based cars from the toolbox you can insert and use as a base, which do this for you.

4 Likes