View Issue Details

IDProjectCategoryView StatusLast Update
0001330The Dark ModAIpublic09.10.2017 14:13
ReporterIshtvan Assigned Tograyman  
PrioritynormalSeveritymajorReproducibilityrandom
Status closedResolutionfixed 
Target VersionTDM 1.05Fixed in VersionTDM 1.05 
Summary0001330: AI weapons sometimes hover in midair after AI goes ragdoll
DescriptionSelf explanatory. Happens most often in melee combat, but I think I've seen it happen with the gas arrow too. The weapons might be clipping into something when they start out, so they don't go anywhere, and then don't know to activate and fall to the ground?
TagsNo tags attached.

Relationships

related to 0001796 closedIshtvan AI switch states before melee animation finishes, leave stale melee clipmodels 
related to 0002214 closedgrayman Strange floating bow after alerting archer 

Activities

nbohr1more

nbohr1more

21.02.2011 22:13

developer   ~0003627

Related to 1796 ?
grayman

grayman

21.02.2011 23:32

viewer   ~0003628

Possibly. My theory is that either at the start of the weapon's "drop", or on its way down, it hits something and stops. Since it never continues the drop at a future time, whatever it hit stays there. An errant clipmodel could do this. Also, whatever it hit is invisible, and that also suggests a clipmodel.
grayman

grayman

24.02.2011 01:53

viewer   ~0003648

At spawn time, map items marked ‘dropToFloor = true’ will drop straight to the floor (or surface) beneath them. Attachments are also marked this way, so when they are freed from a knocked out or killed AI, they go immediately to the floor. Testing where the floor is starts with a test to see if the attachment origin is in a solid, probably to handle the case where the mapper sank the item slightly into what it was sitting on. If the origin of the dropped attachment is inside the dropping AI at the moment this ‘in solid?’ test is made, the attachment comes to rest immediately, leaving it hanging in the air.

The fix is to mark an attachment as ‘dropping’ when it’s released from a knocked out or killed AI, and to not try to force it to the floor immediately. Physics then takes over and the attachment falls naturally.
Springheel

Springheel

24.02.2011 01:55

administrator   ~0003649

Last edited: 24.02.2011 01:56

Wow, you mean this is fixable?? I thought this was one of those bugs we'd have to live with until the source was released. :O

grayman

grayman

24.02.2011 01:58

viewer   ~0003650

Yup, fixed. Will be in 1.05.
Ishtvan

Ishtvan

24.02.2011 06:12

reporter   ~0003656

Good find. They were supposed to just release and activate physics from their current position. I didn't realize they were flagged "drop to floor," and I've never seen them teleport straight down to the floor like other things flagged "drop to floor," but if un-setting it fixes this issue, that's great!
grayman

grayman

24.02.2011 14:37

viewer   ~0003657

I revisited the "teleport" situation because I didn't remember seeing instant appearance of the weapon on the ground.

What's happening is that an attachment dropped by a knocked out or killed AI is marked "dropToFloor", so the first check is to see if it's in a solid. Since the attachment's origin is still in the AI's hand, it's in a solid, so it comes to rest immediately in mid-air. No instant translation to the floor. The "dropToFloor" flag is turned off, since its job is done.

A subsequent collision (most likely with the same AI as it falls) dislodges the attachment from the "at rest" state and allows physics to take over. The attachment then falls naturally.

When a subsequent collision doesn't take place (the AI misses the resting attachment as the AI goes down), the attachment continues to rest in mid-air.

The solution is the same: pay no attention to the "dropToFloor" flag if you're an attachment dropped by a knocked out or killed AI. This skips the initial mid-air rest and allows physics to have its way immediately.
grayman

grayman

24.02.2011 17:52

viewer   ~0003661

Rev. 4627:

physics_rigidbody.cpp
ai.cpp
physics_af.cpp
afentity.cpp
entity.cpp
entity.h
Springheel

Springheel

09.03.2011 18:45

administrator   ~0003743

Hmm, I just had a case where I hit a sitting, card-playing guard with a gas arrow, and his row of cards stayed hovering in the air after he fell.
grayman

grayman

09.03.2011 19:03

viewer   ~0003745

I'll see if I can reproduce this.
grayman

grayman

09.03.2011 19:23

viewer   ~0003746

Verified. If I hit him from the back, he doesn't drop the cards.

Debugging shows cards aren't normal attachments, so they don't go through the "drop me" code. I'll have to figure out what they are and deal with them somewhere else.
Springheel

Springheel

09.03.2011 19:26

administrator   ~0003747

re: The cards aren't normal attachments. They are just def_attached, the same as most weapons as far as I'm aware.
grayman

grayman

09.03.2011 19:45

viewer   ~0003748

That's what I thought. In the code that drops attachments, it goes through a list of attachments and detaches them from the AI. The cards don't show up on that list. So either they were detached earlier elsewhere, or they're kept in some other list.

I've had them hover in the air in one instance, and drop into his lap in the next.

It'll probably be tonight before I can get back to this.
grayman

grayman

09.03.2011 21:54

viewer   ~0003749

I filed issue 0002686 to cover this problem. The solution probably won't be the same as applied here, and probably won't be ready by 1.05 code freeze.

Issue History

Date Modified Username Field Change
06.10.2008 07:10 Ishtvan New Issue
06.10.2008 07:10 Ishtvan Severity normal => major
21.02.2011 21:03 grayman Assigned To => grayman
21.02.2011 21:03 grayman Status new => confirmed
21.02.2011 22:13 nbohr1more Note Added: 0003627
21.02.2011 23:32 grayman Note Added: 0003628
24.02.2011 01:53 grayman Note Added: 0003648
24.02.2011 01:53 grayman Resolution open => fixed
24.02.2011 01:53 grayman Target Version => TDM 1.05
24.02.2011 01:55 Springheel Note Added: 0003649
24.02.2011 01:56 Springheel Note Edited: 0003649
24.02.2011 01:58 grayman Note Added: 0003650
24.02.2011 06:12 Ishtvan Note Added: 0003656
24.02.2011 14:37 grayman Note Added: 0003657
24.02.2011 17:52 grayman Note Added: 0003661
24.02.2011 17:52 grayman Status confirmed => resolved
24.02.2011 17:52 grayman Fixed in Version => TDM 1.05
09.03.2011 18:45 Springheel Note Added: 0003743
09.03.2011 19:03 grayman Note Added: 0003745
09.03.2011 19:23 grayman Note Added: 0003746
09.03.2011 19:26 Springheel Note Added: 0003747
09.03.2011 19:45 grayman Note Added: 0003748
09.03.2011 21:54 grayman Note Added: 0003749
27.10.2011 05:17 greebo Status resolved => closed
28.09.2017 22:20 nbohr1more Relationship added related to 0001796
09.10.2017 14:13 nbohr1more Relationship added related to 0002214