View Issue Details

IDProjectCategoryView StatusLast Update
0006483The Dark ModPhysicspublic10.02.2024 21:37
Reporterstgatilov Assigned To 
PrioritynormalSeveritynormalReproducibilitysometimes
Status newResolutionopen 
Target VersionTDM 2.13 
Summary0006483: Stacked moveables drop into each other after you touch them
DescriptionThe physics code requires about 0.25-1.0 distance between object in order to handle collisions between them properly.

Normally, mapper is expected to put moveables some distance above the object below them.
Then the special "DropToFloor" code moves them down as much as collision code allows at map start (see idPhysics_RigidBody::DropToFloorAndRest).
However, sometimes mapper puts a moveable exactly on top of the object below it, and this problem currently is not resolved.

As the result, the moveable falls into the object below it as soon as you touch it.
Note that if you don't touch it, then the object stays in place because it is put to "rest" at spawn a time.
So it is very difficult for a mapper to detect this issue.
Steps To ReproduceStart Inn Business mission, go to the locations with many moveables.
For instance: "setviewpos 600 -80 70 0 180 0", grab one jar and collide it with other objects.
Another good location is "setviewpos 850 1050 210 0 -90 0": the object here would benefit from better initial placement.

You can also get this issue in Saint Lucia mission.
"setviewpos 1300 3400 -380 0 180 0" and jump on top of the barrel: the barrel falls into the ground.
TagsPhysics, realism

Relationships

related to 0000665 new Moveables stacked on top of eachother begin to levitate up 
related to 0001073 new Butcher Knife & Kitchen Knife Levitating 
related to 0003543 new Bad physics for small moveables 

Activities

stgatilov

stgatilov

10.02.2024 11:22

administrator   ~0016494

The function idPhysics_RigidBody::DropToFloorAndRest traces a ray down and uses the position of first collision to decide where to put object.
The core idea is to start tracing from a bit higher position (by 1.0 at least) so that object can also geet a bit higher if necessary.

It seems that DropToFloor is only used on game start.
In original Doom 3 it was also applied to reaspawned powerups, but we don't use this feature.
Perhaps we can remove the code from runtime, and instead run it globally on map start.
It is much easier to handle all the entities in one piece of code than to run separate code chunks for each moveable and fight e.g. with gravity already turned on.

Speaking of a single function, we can probably do e.g. 10 passes over all moveables performing the adjustment for them.
The exact number of passes necessary depends on how deeply the moveables are stacked.

Another problem is when the moveables are inside each other (e.g. the pillows near the floor at "setviewpos 850 1050 210 0 -90 0" of Inn Business).
Just pushing each entity up will cause all of them to raise simultaneously, thus not resolving the collision.
Perhaps sort moveables by lowest Z and apply the tweak in this order, each time resolving the collision completely.
In this case there is no limit how high an object can raise if it collides something.

Finally, the function "idPhysics_RigidBody::DropToFloorAndRest" has a lot of useful warning, but they are disabled and nobody knows about them.
I guess we should post warnings if entity ends up outside playable area, or we failed to resolve collisions, or if an entity was moved too far either direction.

Issue History

Date Modified Username Field Change
10.02.2024 11:11 stgatilov New Issue
10.02.2024 11:22 stgatilov Note Added: 0016494
10.02.2024 14:13 nbohr1more Relationship added related to 0000665
10.02.2024 14:13 nbohr1more Relationship added related to 0001073
10.02.2024 14:15 nbohr1more Relationship added related to 0003543
10.02.2024 21:37 Fiver Tag Attached: realism
10.02.2024 21:37 Fiver Tag Attached: Physics