Faulty hinge constraint servo

PC Info: Happens across Roblox
Date first experienced: i can’t remember
Date last experienced: 10/3/2023


Here’s an image showing this issue

Expected Behaviour: the HingeConstraint must move to the “TargetAngle“ at the speed set by the “AngularSpeed” property

Actual behaviour:
The HingeConstraint stops moving prematurely before it reaches the “ TargetAngle” set in the property of the HingeConstraint

It happens with every hinge constraint servo motor used, plus it only happens if the servo speed is set from 0.1 to 0.9 (very slow speed)
And even it happens across many games with hinge constraints set as servo motors that move at a slow speed,
Even one of my friends saw it in a game.

This is where me and one of my friends experienced this malfunction

2 Likes

We’ve filed a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for flagging!

1 Like

No problem @Focia19.
I don’t like glitches

1 Like

Hi,

Can you please provide a reproduction of this issue?

Thanks!

I can provide a reproduction, but I’ m using motor drive:
Localscript:

print("Hello world!")
local p:Part = Instance.new("Part")


p.Name = "Spinner"
p.Color = Color3.new(1, 1, 0)
p.CFrame = CFrame.new(0,5,-10)
p.Anchored = false
p.CanCollide = true
p.CanTouch = false
p.EnableFluidForces = false
p.CastShadow = true
--p.CastShadow = false


q = p:Clone()


q.CFrame = CFrame.new(0,5,-10)
q.Color = Color3.new(0, 0.666667, 0)
q.Anchored = true
q.CanCollide = false
q.CanTouch = false
q.EnableFluidForces = false
q.CastShadow = false
q.Transparency = 1
q.Name = "Teacher"


local at1:Attachment = Instance.new("Attachment")
at1.CFrame = CFrame.new() * CFrame.Angles(0,0,math.pi/2)
local at2:Attachment = Instance.new("Attachment")
at2.Parent = p
at1.Parent = q
at2.WorldCFrame = at1.WorldCFrame




local ap:HingeConstraint = Instance.new("HingeConstraint")

ap.Attachment0 = at2
ap.Attachment1 = at1


ap.MotorMaxTorque = 500000
ap.MotorMaxAcceleration = 50000
ap.AngularVelocity = .1
ap.ActuatorType = Enum.ActuatorType.Motor
ap.Parent = p
local f:Folder = Instance.new("Folder")
f.Name = "Spinners"
q.Parent = f

p.Parent = f
local partList: {[number]:Part} = {}


for x = 1, 60, 1 do
	local a = q:Clone() --teacher
	local b = p:Clone() --spinner
	b.HingeConstraint.Attachment0 = b.Attachment
	b.HingeConstraint.Attachment1 = a.Attachment
	
	a:PivotTo(a:GetPivot() * CFrame.new(6*x,0,0))
	b:PivotTo(a:GetPivot())
	a.Parent = f
	b.Parent = f
	
end

f.Parent = workspace

Well, it only happens on HingeConstraints as servos. When I tell it to go to a specific position it may prematurely stop before it reaches the target angle. This can be fixed by increasing the speed but some applications may need slower speeds but it doesn’t really work.

You described my experience exactly. Thank you. In my case I need/want the very slow speed, but I was using the hinges in motor mode. < .5 The stall at slow angular velocities happens there too. I’m concerned that you say it only happens on HingeConstraints as servos. It happens as motors too. I provided an example script in my last post that reproduces the problem.

Here is another reproduction of the problem. The spoon on the right stalls. The accessories next to it won’t rotate unless the angular velocity is >= 1

I have provide two reproductions. Hopefully, you can fix this issue.

@iondrive Thanks for providing the repro!

@Rileyg1974 The behavior that you both are observing is a result of the physics sleep system. When parts are moving “slow enough” that they are essentially not moving, the physics engine puts them to sleep to improve performance (see this post for a more detailed description). The sleep system includes a set of velocity tolerances. If a part is moving below the velocity tolerance, it is considered not moving, and goes to sleep.

To see when parts are asleep or awake in Roblox Studio, you can go to File → Studio Settings → Are Awake Parts Highlighted. For the repro that @iondrive posted, the part is initially awake (highlighted in red), and then goes to sleep (highlight disappears):
sleep
Since the part is moving very slowly (below the velocity tolerance), the sleep system decides that this part is not moving and puts it to sleep. Note that this can happen regardless of the type of actuator used to move a part, so it’s possible to reproduce the behavior with servos or motors driving any type of constraint.

The simplest fix is to simply use a higher servo/motor velocity to ensure that all parts are moving faster than the velocity threshold. Please let me know if this is a workable solution for you!

Thanks

Now I understand, thanks. The hingeconstraint is used to twirl an accessory on display, so it can be viewed from all angles. If it is not moving very slowly, it is difficult to get a good look.

i get it now, when Roblox detects a part that isn’t moving, it puts it to sleep to prevent performance drops. That’s why the vane on the air conditioners stopped moving! So when the part isn’t moving the outline disappears! The outline is attributed to “Awake Parts Highlighted”. That makes sense I understand a little more about Roblox’s physics engine

Servos are pretty buggy. Overshooting the target angle causes retargeting issues where it constantly bounces around with too much force. High amounts of torque should help reach the target angle more, but it causes more retargeting.

You got it! We’re currently putting together additional documentation of the sleep system on the Creator Hub which will provide even more detail, stay tuned!