View Issue Details

IDProjectCategoryView StatusLast Update
0003061FSSCPgraphicspublic2014-06-16 16:03
ReporterAxem Assigned ToMageKing17  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0003061: Weird initial states with animated objects
DescriptionSee test mod: http://www.mediafire.com/download/eqnjkgppwajn4wi/CainTest.rar

The Cain's arms should be straight in its initial state, but they are bent inwards (which is their deployed state). When you press 1, the arms suddenly jump to the proper initial state and then animate properly. After the beams fire the arms reset and go to the correct positions.

Maybe this has something to do with the fact that the outer arms are children of another triggered animation subobject?
TagsNo tags attached.

Activities

Echelon9

2014-06-15 04:49

developer   ~0015874

Can you test if there's a particular release or RC that this behaviour first appeared for you?

MageKing17

2014-06-15 07:47

developer  

modelanim.cpp.patch (1,346 bytes)   
Index: code/model/modelanim.cpp
===================================================================
--- code/model/modelanim.cpp	(revision 10819)
+++ code/model/modelanim.cpp	(working copy)
@@ -840,16 +840,18 @@
 		psub = pss->system_info;
 
 		for (i = 0; i < psub->n_triggers; i++) {
-			if (psub->type == SUBSYSTEM_TURRET) {
-				// special case for turrets
-				pss->submodel_info_2.angs.p = psub->triggers[i].angle.xyz.x;
-				pss->submodel_info_1.angs.h = psub->triggers[i].angle.xyz.y;
-			} else if (psub->triggers[i].type == TRIGGER_TYPE_INITIAL) {
-				Assert(pss->triggered_rotation_index >= 0);
-				triggered_rotation *tr = &Triggered_rotations[pss->triggered_rotation_index];
+			if (psub->triggers[i].type == TRIGGER_TYPE_INITIAL) {
+				if (psub->type == SUBSYSTEM_TURRET) {
+					// special case for turrets
+					pss->submodel_info_2.angs.p = psub->triggers[i].angle.xyz.x;
+					pss->submodel_info_1.angs.h = psub->triggers[i].angle.xyz.y;
+				} else {
+					Assert(pss->triggered_rotation_index >= 0);
+					triggered_rotation *tr = &Triggered_rotations[pss->triggered_rotation_index];
 
-				tr->set_to_initial(&psub->triggers[i]);
-				tr->apply_trigger_angles(&pss->submodel_info_1.angs);
+					tr->set_to_initial(&psub->triggers[i]);
+					tr->apply_trigger_angles(&pss->submodel_info_1.angs);
+				}
 			}
 		}
 	}
modelanim.cpp.patch (1,346 bytes)   

MageKing17

2014-06-15 07:49

developer   ~0015875

The problem seems to be caused by the fact that they're turrets with defined animation data; for some reason, model_anim_set_initial_states() was following a "special case" for turrets for every single animation present on the subobject; moving this code to be under the (psub->triggers[i].type == TRIGGER_TYPE_INITIAL) check eliminates the issue.

MageKing17

2014-06-15 18:13

developer   ~0015879

Given that rotating turrets triggers an Assertion in ship.cpp (followed by a comment that "Turrets can't rotate!!!"), and that ignoring this and doing it anyway (with a Release build) results in no collision detection as soon as the turret starts rotating, I'm suspending this issue.

MageKing17

2014-06-16 04:54

developer  

ship.cpp.patch (653 bytes)   
Index: code/ship/ship.cpp
===================================================================
--- code/ship/ship.cpp	(revision 10819)
+++ code/ship/ship.cpp	(working copy)
@@ -12262,9 +12262,7 @@
 			case SUBSYSTEM_SOLAR:
 			case SUBSYSTEM_GAS_COLLECT:
 			case SUBSYSTEM_ACTIVATION:
-				break;
 			case SUBSYSTEM_TURRET:
-				Assertion( !(psub->flags & MSS_FLAG_ROTATES), "Turret %s on ship %s has the $rotate or $triggered subobject property defined. Please fix the model.\n", psub->name, Ship_info[shipp->ship_info_index].name ); // Turrets can't rotate!!! See John!
 				break;
 			default:
 				Error(LOCATION, "Illegal subsystem type.\n");
ship.cpp.patch (653 bytes)   

MageKing17

2014-06-16 04:55

developer   ~0015880

Per IRC conversation, it turns out the lack of collision was due to the bounding box for the ship being smaller than the space into which the arms were rotating. I've instead attached an extra patch to get rid of the apparently-no-longer-relevant assertion, and returned this issue to code review.

Issue History

Date Modified Username Field Change
2014-06-15 02:21 Axem New Issue
2014-06-15 04:49 Echelon9 Note Added: 0015874
2014-06-15 07:44 MageKing17 Assigned To => MageKing17
2014-06-15 07:44 MageKing17 Status new => assigned
2014-06-15 07:47 MageKing17 File Added: modelanim.cpp.patch
2014-06-15 07:49 MageKing17 Note Added: 0015875
2014-06-15 07:49 MageKing17 Status assigned => code review
2014-06-15 18:13 MageKing17 Note Added: 0015879
2014-06-15 18:13 MageKing17 Status code review => closed
2014-06-15 18:13 MageKing17 Resolution open => suspended
2014-06-15 22:02 Zacam Status closed => assigned
2014-06-16 04:54 MageKing17 File Added: ship.cpp.patch
2014-06-16 04:55 MageKing17 Note Added: 0015880
2014-06-16 04:55 MageKing17 Status assigned => code review
2014-06-16 15:48 The_E Status code review => assigned
2014-06-16 15:59 MageKing17 Status assigned => resolved
2014-06-16 15:59 MageKing17 Resolution suspended => fixed