2019-10-14 12:51 EDT


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003115FSSCPmodelspublic2016-03-07 14:49
ReporterBlack Wolf 
Assigned ToGoober5000 
PriorityhighSeverityminorReproducibilityalways
Statuscode reviewResolutionopen 
Product Version 
Target Version3.8Fixed in Version 
Summary0003115: look_at has been removed from the engine
DescriptionLast year, VA mentioned that he had accidentally broken look_at for submodels (http://www.hard-light.net/forums/index.php?topic=84897.msg1713468#msg1713468).

The feature has yet to be repaired and reintegrated with the engine as of the September 17 nightly.
Steps To ReproduceLaunch fighters from the Praetor. Its hydraulic rams should be looking at each other, instead they follow the orientation of the bay doors.
Additional InformationSee thread here: http://www.hard-light.net/forums/index.php?topic=88393.0
TagsNo tags attached.
Attached Files
  • 7z file icon Praetor.7z (722,861 bytes) 2014-10-01 08:15
  • patch file icon 3115.patch (2,617 bytes) 2014-10-17 18:52 -
    Index: code/model/modelinterp.cpp
    ===================================================================
    --- code/model/modelinterp.cpp	(revision 11150)
    +++ code/model/modelinterp.cpp	(working copy)
    @@ -1952,6 +1952,8 @@
     void model_render(int model_num, matrix *orient, vec3d * pos, uint flags, int objnum, int lighting_skip, int *replacement_textures, const bool is_skybox)
     {
     	int cull = 0;
    +
    +	model_do_look_at(model_num);
     	// replacement textures - Goober5000
     	model_set_replacement_textures(replacement_textures);
     
    Index: code/model/modelread.cpp
    ===================================================================
    --- code/model/modelread.cpp	(revision 11150)
    +++ code/model/modelread.cpp	(working copy)
    @@ -1259,14 +1259,6 @@
     					}
     				}
     
    -				// Sets can_move on submodels which are of a rotating type or which have such a parent somewhere down the hierarchy
    -				if ( (pm->submodel[n].movement_type != MOVEMENT_TYPE_NONE)
    -					|| strstr(props, "$triggered:") || strstr(props, "$rotate") || strstr(props, "$dumb_rotate:") || strstr(props, "$gun_rotation:") || strstr(props, "$gun_rotation") ) {
    -					pm->submodel[n].can_move = true;
    -				} else if (pm->submodel[n].parent > -1 && pm->submodel[pm->submodel[n].parent].can_move) {
    -					pm->submodel[n].can_move = true;
    -				}
    -
     				if ( ( p = strstr(props, "$look_at:")) != NULL ) {
     					pm->submodel[n].movement_type = MOVEMENT_TYPE_LOOK_AT;
     					get_user_prop_value(p+9, pm->submodel[n].look_at);
    @@ -1283,6 +1275,14 @@
     					pm->submodel[n].dumb_turn_rate = 0.0f;
     				}
     
    +				// Sets can_move on submodels which are of a rotating type or which have such a parent somewhere down the hierarchy
    +				if ( (pm->submodel[n].movement_type != MOVEMENT_TYPE_NONE)
    +					|| strstr(props, "$triggered:") || strstr(props, "$rotate") || strstr(props, "$gun_rotation:") || strstr(props, "$gun_rotation") ) {
    +					pm->submodel[n].can_move = true;
    +				} else if (pm->submodel[n].parent > -1 && pm->submodel[pm->submodel[n].parent].can_move) {
    +					pm->submodel[n].can_move = true;
    +				}
    +
     				if ( pm->submodel[n].name[0] == '\0' ) {
     					strcpy_s(pm->submodel[n].name, "unknown object name");
     				}
    @@ -3472,7 +3472,7 @@
     		}
     
     		if (sm->look_at_num == -2) {
    -			Warning( LOCATION, "Invalid submodel name given in $look_at: property in model file <%s>. (%s looking for %s)\n", pm->filename, pm->submodel->name, sm->look_at );
    +			Warning( LOCATION, "Invalid submodel name given in $look_at: property in model file <%s>. (%s looking for %s)\n", pm->filename, sm->name, sm->look_at );
     			sm->look_at_num = -1; // Set to -1 to not break stuff
     		}
     	}
    
    patch file icon 3115.patch (2,617 bytes) 2014-10-17 18:52 +

-Relationships
+Relationships

-Notes

~0016336

MageKing17 (developer)

Relevant: http://www.hard-light.net/forums/index.php?topic=83628.msg1709474#msg1709474

~0016339

MageKing17 (developer)

Last edited: 2014-10-17 18:55

View 2 revisions

So I've uploaded a simple patch that adds the missing line from the above link, plus a couple of minor tweaks on the parsing side. This (plus fixing the provided POF to use submodel names instead of numbers) makes the example work, but still has the worrisome potential performance issues brought up in the previously-linked thread.

~0016643

Goober5000 (administrator)

Assigning this to The_E for review. It would be nice to have this figured out given that the look_at feature was meant for 3.7.0 and then forgotten.

~0016782

m_m (developer)

Maybe the performance issues could be reduced by only traversing the model hierarchy for the models that actually use look_at by setting a flag when the model is loaded?

~0016783

MageKing17 (developer)

As The_E already noted back in 2013: http://www.hard-light.net/forums/index.php?topic=83628.msg1709521#msg1709521

Goober's suggestion immediately after (http://www.hard-light.net/forums/index.php?topic=83628.msg1709547#msg1709547) was to incorporate the look_at stuff into one of the existing traversals, which makes a lot of sense, but at the very least, a model flag would be better than doing the traversal for everything every frame.

~0016788

m_m (developer)

I made a PR for this: https://github.com/scp-fs2open/fs2open.github.com/pull/358

Currently untested because I have no test mission. I'm also not sure if my usage of model_look_at is right in model_render_queue.

~0016811

Goober5000 (administrator)

New PR opened: https://github.com/scp-fs2open/fs2open.github.com/pull/530

Almost, but not quite, ready to be resolved.

~0016812

Goober5000 (administrator)

I've told chief1983 and The E that I'm bumping this to 3.7.6. The refactoring is complete, but the angle calculation is proving extremely difficult to get working for all models in all situations.
+Notes

-Issue History
Date Modified Username Field Change
2014-10-01 08:15 Black Wolf New Issue
2014-10-01 08:15 Black Wolf File Added: Praetor.7z
2014-10-03 17:53 Goober5000 Priority normal => high
2014-10-03 17:53 Goober5000 Status new => confirmed
2014-10-03 17:53 Goober5000 Target Version => 3.7.2
2014-10-09 19:47 MageKing17 Note Added: 0016336
2014-10-17 18:52 MageKing17 File Added: 3115.patch
2014-10-17 18:55 MageKing17 Note Added: 0016339
2014-10-17 18:55 MageKing17 Note Edited: 0016339 View Revisions
2014-11-20 23:04 Goober5000 Status confirmed => code review
2015-04-16 00:31 Goober5000 Note Added: 0016643
2015-04-16 00:31 Goober5000 Assigned To => The_E
2015-04-16 14:12 The_E Target Version 3.7.2 => 3.7.4
2015-09-18 08:29 m_m Note Added: 0016782
2015-09-18 16:20 MageKing17 Note Added: 0016783
2015-09-23 13:29 m_m Note Added: 0016788
2016-01-31 22:21 Goober5000 Note Added: 0016811
2016-01-31 22:21 Goober5000 Assigned To The_E => Goober5000
2016-03-07 14:49 Goober5000 Note Added: 0016812
2016-03-07 14:49 Goober5000 Target Version 3.7.4 => 3.8
+Issue History