View Issue Details

IDProjectCategoryView StatusLast Update
0002693FSSCPphysicspublic2012-12-06 20:15
ReporterAlan Bolte Assigned ToValathil  
PrioritynormalSeveritytrivialReproducibilityalways
Status resolvedResolutionfixed 
OSWindows 7 Pro 64bitOS VersionSP1 
Product Version3.6.14 RC6 
Summary0002693: Unexpected behavior of $no_collisions
Description$no_collisions and $nocollide_this_only do not completely eliminate collision detection.
Steps To ReproduceLoad the test mission and watch. The Fenris with $no_collisions applied will collide with the Ganymede. You can fly through the Fenris, but not its rotating antenna.
Modifying the Fenris's main hull to have $nocollide_this_only instead will enable collision on the turrets, but the ship as a whole will still collide with the Ganymede.
Additional InformationInitially reported in this thread:
http://www.hard-light.net/forums/index.php?topic=81516.0
Haven't done any more testing since then.

I tried this in the first place because I wanted to make a ship that was nothing but turrets, so my idea was just to make the main hull invisible and $nocollide_this_only. I haven't tried the invisible texture thing yet.
TagsNo tags attached.

Activities

Alan Bolte

2012-08-03 05:56

reporter  

Collision Test.zip (869,233 bytes)

Valathil

2012-12-06 17:26

developer   ~0014338

Last edited: 2012-12-06 18:47

These are actually 2 issues.

1) You can collide with the antenna, for which i'll post a patch soon.
and
2) Where the fenris as the lighter of two ships in a ship2ship collision doesnt check the $no_collision flag. Well see the problem here is that the lighter ship is for purposes of collision detection just a sphere. There is no code that checks for submodels or anything. Thats also why you can fly through the fenris but the fenris cant fly through the ganymede -> the player ship is the lighter ship in that case so it checks the full ganymede model and the player ship is just a sphere. Only thing that can be done is making a detail0 no collide flag equivalent to the ship_info no collide flag. Subsystem resulution is sadly not possible. I think OP wanted a ship thats just turrets. No chance for that except when all ships that can collide with this are smaller than the turret only ship.

Valathil

2012-12-06 18:45

developer  

2693.patch (1,494 bytes)   
Index: code/model/modelread.cpp
===================================================================
--- code/model/modelread.cpp	(revision 9404)
+++ code/model/modelread.cpp	(working copy)
@@ -4114,13 +4114,17 @@
 	bsp_info *child_submodel;
 	
 	child_submodel = &pm->submodel[pm->detail[0]];
+	
+	if(child_submodel->no_collisions) { // if detail0 has $no_collision set dont check childs
+		return;
+	}
 
 	int i = child_submodel->first_child;
 	while ( i >= 0 )	{
 		child_submodel = &pm->submodel[i];
 
 		// Don't check it or its children if it is destroyed or it is a replacement (non-moving)
-		if ( !child_submodel->blown_off && (child_submodel->i_replace == -1) )	{
+		if ( !child_submodel->blown_off && (child_submodel->i_replace == -1) && !child_submodel->nocollide_this_only)	{
 
 			// Only look for submodels that rotate
 			if (child_submodel->movement_type == MOVEMENT_TYPE_ROT) {
Index: code/object/collideshipship.cpp
===================================================================
--- code/object/collideshipship.cpp	(revision 9404)
+++ code/object/collideshipship.cpp	(working copy)
@@ -236,9 +236,15 @@
 
 	SCP_vector<int> submodel_vector;
 	int valid_hit_occured = 0;
-	polymodel *pm;
+	polymodel *pm, *pm_light;
 	polymodel_instance *pmi;
+		
+	pm_light = model_get(Ship_info[light_shipp->ship_info_index].model_num);
 
+	if(pm_light->submodel[pm_light->detail[0]].no_collisions) {
+		return 0;
+	}
+
 	if (model_collide(&mc)) {
 
 		// Set earliest hit time
2693.patch (1,494 bytes)   

Valathil

2012-12-06 20:15

developer   ~0014340

Fix committed to Trunk @ 9405

Issue History

Date Modified Username Field Change
2012-08-03 05:56 Alan Bolte New Issue
2012-08-03 05:56 Alan Bolte File Added: Collision Test.zip
2012-12-06 17:26 Valathil Note Added: 0014338
2012-12-06 17:37 Valathil File Added: modelread.cpp.patch
2012-12-06 18:45 Valathil File Deleted: modelread.cpp.patch
2012-12-06 18:45 Valathil File Added: 2693.patch
2012-12-06 18:47 Valathil Note Edited: 0014338
2012-12-06 20:14 Valathil Assigned To => Valathil
2012-12-06 20:14 Valathil Status new => assigned
2012-12-06 20:15 Valathil Note Added: 0014340
2012-12-06 20:15 Valathil Status assigned => resolved
2012-12-06 20:15 Valathil Resolution open => fixed