View Issue Details

IDProjectCategoryView StatusLast Update
0001073The Dark ModPhysicspublic06.12.2026 14:01
ReporterIshtvan Assigned To 
PrioritynormalSeveritynormalReproducibilityalways
Status newResolutionopen 
Summary0001073: Butcher Knife & Kitchen Knife Levitating
DescriptionIf you rest the point of the kitchen knife or the end of the butcher knife on another moveable, like a turnip, they start levitating up for a while. [EDIT: Both objects levitate, the turnip underneath and the knife on top. I also think you have to drop the knife on, it may not start levitating if you carefully set it down]. They usually fall back down after 30 seconds or so. Is there something different about the clipmodels or physics settings on these moveabls?
TagsNo tags attached.

Relationships

related to 0004435 closedduzenko Investigate fp-precision related issues 
related to 0003452 resolvedgrayman Moveable planks don't fall realistically 
related to 0000665 new Moveables stacked on top of eachother begin to levitate up 
related to 0003543 new Bad physics for small moveables 
related to 0006483 new Stacked moveables drop into each other after you touch them 

Activities

nbohr1more

nbohr1more

10.10.2017 01:53

developer   ~0009442

Still reproducible with the moveable_kitchen_knife_chef entity. I wasn't able to reproduce with the ornamental knife. The collision (mesh?) thickness is probably at the size boundary of the physics system. With the turnip, it clips through the blade sometimes.

user81

28.03.2018 09:14

  ~0010185

Are we sure its not just a bad collision mesh..?
nbohr1more

nbohr1more

31.12.2020 03:58

developer   ~0013325

g_showCollisionModels shows that the knife has flat triangles which may be confusing to the collision parser.

Otherwise the model appears to be solid.
nbohr1more

nbohr1more

01.01.2021 18:59

developer   ~0013342

@stgatilov: Is this fixable via changes to the physics code? If not, this should just be another asset fix tracker.
nbohr1more

nbohr1more

14.12.2022 02:54

developer   ~0015560

Still reproducible in 2.11
nbohr1more

nbohr1more

15.06.2024 19:33

developer   ~0016742

Still reproducible in 2.13 Dev 10800. Strangely variable. In one case I was able to watch the levitation reach the ceiling when another instance it stopped mid-air at ankle height...
nbohr1more

nbohr1more

06.12.2026 00:31

developer   ~0017419

The attached patch resolves this
tdm_1073_collision_restitution.patch (1,242 bytes)   
--- a/game/physics/Physics_RigidBody.cpp
+++ b/game/physics/Physics_RigidBody.cpp
@@ -500,12 +500,25 @@
 	// velocity in normal direction
 	vel = velocity * collision.c.normal;
 
-	if ( vel > -OLD_STOP_SPEED ) // grayman #3452 - was STOP_SPEED
+	// Do not inject a minimum impulse into slow or separating contacts.
+	// The old code used OLD_STOP_SPEED as a fixed positive impulse whenever
+	// the approach speed was below the threshold. That adds energy even when
+	// the bodies are already separating (vel > 0), and can make resting
+	// moveables repeatedly bounce/levitate as gravity re-establishes contact.
+	if ( vel >= 0.0f )
 	{
-		impulseNumerator = OLD_STOP_SPEED;
+		// The bodies are separating (or have no relative normal motion).
+		impulseNumerator = 0.0f;
+	}
+	else if ( vel > -OLD_STOP_SPEED )
+	{
+		// Low-speed impact: remove the incoming normal velocity without
+		// applying restitution or adding artificial kinetic energy.
+		impulseNumerator = -vel;
 	}
 	else
 	{
+		// Normal restitution for a sufficiently fast impact.
 		impulseNumerator = -( 1.0f + bouncyness ) * vel;
 	}
 	impulseDenominator = inverseMass + ( ( inverseWorldInertiaTensor * r.Cross( collision.c.normal ) ).Cross( r ) * collision.c.normal );
stgatilov

stgatilov

06.12.2026 13:56

administrator   ~0017431

Last edited: 06.12.2026 14:01

I believe this is exactly the issue of 0003452.
Except that 0003452 was a regression from bumping the velocity tolerance, and Grayman resolved it by reverting the tolerance back.

I have a pretty strong fear that this change will cause objects to penetrate into each other.
Especially when there is a pile of moveables that player messes with, so the all the objects are close to each other and they are trying to slow down to rest.
The reason is that the engine expects all objects to be at distance >= CONTACT_EPSILON = 0.25 from each other.
If the objects collide and stop at much closer distance, then they will fall through each other when you move them again.

This patch has actually two parts:
1) If objects are already separating, don't change their velocity.
2) If the objects are penetrating at slow speed, change their velocity so that it becomes zero after impact.
Also note that an object may have several collisions at once, in which case all these individual impulses are summed together.

The part 1 looks OK. It can become a problem only for a very low separation speed, which hopefully happens rarely.
The part 2 looks especially troublesome, since it tells those "coming to rest" objects to stop without pushing away from each other (well, if we assume no simultaneous collisions).

By the way, if you just want to avoid extra pushout, then you can simply delete the case vel > -OLD_STOP_SPEED.
Then objects will not stop immediately on slow collision, but they will bounce away naturally: the pushout will be at least enough to stop penetration, and even more than that.
But it is most likely not enough to stop falling through, otherwise I guess ID guys wouldn't have added this case.

UPDATE: Actually, the reliable pushout would look something like:
  impulseNumerator = -( 1.0f + bouncyness ) * vel; // normal pushout
  impulseNumerator = max( impulseNumerator, OLD_STOP_SPEED - vel, 0 ); // make sure separation speed will become at least OLD_STOP_SPEED

Issue History

Date Modified Username Field Change
03.09.2008 09:16 Ishtvan New Issue
03.09.2008 17:14 Ishtvan Description Updated
03.09.2008 17:15 Ishtvan Description Updated
09.10.2017 14:03 nbohr1more Relationship added related to 0000665
09.10.2017 14:06 nbohr1more Relationship added related to 0004435
09.10.2017 21:40 nbohr1more Relationship added related to 0003543
10.10.2017 01:53 nbohr1more Note Added: 0009442
28.03.2018 09:14 user81 Note Added: 0010185
31.12.2020 03:58 nbohr1more Note Added: 0013325
01.01.2021 18:59 nbohr1more Note Added: 0013342
14.12.2022 02:54 nbohr1more Note Added: 0015560
10.02.2024 14:13 nbohr1more Relationship added related to 0006483
15.06.2024 19:33 nbohr1more Note Added: 0016742
15.06.2024 19:33 nbohr1more File Added: closemouthed_shadows (2024-06-15 15-23-18) (-226.07 -549.72 -83.75).jpg
15.06.2024 19:33 nbohr1more File Added: closemouthed_shadows (2024-06-15 15-28-17) (-253.75 -527.1 -117.75).jpg
06.12.2026 00:31 nbohr1more Note Added: 0017419
06.12.2026 00:31 nbohr1more File Added: tdm_1073_collision_restitution.patch
06.12.2026 13:21 stgatilov Relationship added related to 0003452
06.12.2026 13:56 stgatilov Note Added: 0017431
06.12.2026 13:56 stgatilov Note Edited: 0017431
06.12.2026 13:57 stgatilov Note Edited: 0017431
06.12.2026 14:00 stgatilov Note Edited: 0017431
06.12.2026 14:01 stgatilov Note Edited: 0017431