godotengine / godotengine/godot

Angular Limit from Pinjoint2D causes to rotate Node B erraticly.

Open
#88,481 3 comments 9 reactions 0 assignees View on GitHub
bug topic:2d topic:physics
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproducable in:
4.2.1.stable_mono
4.3-dev3_mono

### System information

Windows 10

### Issue description

If you create RigidBody2Ds, neither is a child of the other, and use Pinjoint2D to connect the two. The issue begins when you enable angular limit and set the upper and lower rotation limit, one of the nodes in the joint will start rotating around the joint uncontrollably.

In the video, the torque around the joint isn't building up immediately after it rotates around, it only starts to build up torque. This seems rather unpredictable.

When lower > upper || upper < lower, the node immediately builds up torque more and more unpredictably. Otherwise, other forces have to rotate the node around the joint before triggering the effect, with the two limits converging makes it more likely with less rotation required.

https://github.com/godotengine/godot/assets/138860645/3d411aa8-9a3f-477b-a438-3a56cb2b843a

### Steps to reproduce

Physics bodies and a Rigidybody connected with a pinjoint.
Enable angular limit.
Set the upper and lower limit.

### Minimal reproduction project (MRP)

[TestProject.zip](https://github.com/godotengine/godot/files/14321747/TestProject.zip)

```[tasklist]
### Tasks
```

Contributor guide

Open the contributing guide

Research direction

Start with the attached TestProject.zip and reproduce the PinJoint2D setup using two independent RigidBody2D nodes and angular limits. Test lower and upper limits in both converging and reversed configurations on the reported versions, then verify that neither connected node rotates uncontrollably or builds torque unpredictably.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.