View Issue Details

IDProjectCategoryView StatusLast Update
0003060FSSCPbeamspublic2014-06-16 15:57
ReporterAxem Assigned ToMageKing17  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0003060: Beam Particle Ani issues on turrets that are children of subobjects
DescriptionIf a beam turret fires and its a child of a non-detail0 subobject, the particle anis don't appear at the beam generation point like the muzzle glow does.

It looks like its using the offset from the turret to the parent, but then just bases the particles off of detail0 instead of the parent. (If that makes sense, running the test mod and seeing where the particle anis generate from its a lot more descriptive)
Steps To ReproduceRun the test mod, press 1 to have the 5-armed Cain fire its beams. The particles generated won't line up with the beams being fired.

http://www.mediafire.com/download/eqnjkgppwajn4wi/CainTest.rar
TagsNo tags attached.

Activities

MageKing17

2014-06-15 08:14

developer   ~0015876

The way particles position was calculated was definitely screwed up... I tried to make the calculations better, and they're at least near the turrets in the test, but the particles are still "off"; they float around in the general vicinity of the turret, off to one side, instead of surrounding it and moving inward. I'll probably keep working on this, but vector math is not my strong suit.

MageKing17

2014-06-15 08:24

developer  

beam_particles.patch (2,305 bytes)   
Index: code/weapon/beam.cpp
===================================================================
--- code/weapon/beam.cpp	(revision 10819)
+++ code/weapon/beam.cpp	(working copy)
@@ -354,7 +354,6 @@
 	new_item->objp = fire_info->shooter;
 	new_item->sig = fire_info->shooter->signature;
 	new_item->subsys = fire_info->turret;	
-	new_item->local_pnt = fire_info->turret->system_info->pnt;
 	new_item->life_left = wip->b_info.beam_life;	
 	new_item->life_total = wip->b_info.beam_life;
 	new_item->r_collision_count = 0;
@@ -1267,7 +1266,7 @@
 	int particle_count;
 	int idx;
 	weapon_info *wip;
-	vec3d turret_norm, turret_pos, particle_pos, particle_dir, p_temp;
+	vec3d turret_norm, turret_pos, particle_pos, particle_dir;
 	matrix m;
 	particle_info pinfo;
 
@@ -1296,7 +1295,7 @@
 	particle_count = (int)frand_range(0.0f, (float)wip->b_info.beam_particle_count);
 
 	// get turret info - position and normal
-	turret_pos = b->local_pnt;
+	turret_pos = b->last_start;
 	turret_norm = b->subsys->system_info->turret_norm;	
 
 	// randomly perturb a vector within a cone around the normal
@@ -1304,15 +1303,8 @@
 	for(idx=0; idx<particle_count; idx++){
 		// get a random point in the cone
 		vm_vec_random_cone(&particle_dir, &turret_norm, wip->b_info.beam_particle_angle, &m);
-		p_temp = turret_pos;
-		vm_vec_scale_add(&p_temp, &turret_pos, &particle_dir, wip->b_info.beam_muzzle_radius * frand_range(0.75f, 0.9f));
+		vm_vec_scale_add(&particle_pos, &turret_pos, &particle_dir, wip->b_info.beam_muzzle_radius * frand_range(0.75f, 0.9f));
 
-		// transform into world coords		
-		vm_vec_unrotate(&particle_pos, &p_temp, &b->objp->orient);
-		vm_vec_add2(&particle_pos, &b->objp->pos);
-		p_temp = particle_dir;
-		vm_vec_unrotate(&particle_dir, &p_temp, &b->objp->orient);
-
 		// now generate some interesting values for the particle
 		float p_time_ref = wip->b_info.beam_life + ((float)wip->b_info.beam_warmup / 1000.0f);		
 		float p_life = frand_range(p_time_ref * 0.5f, p_time_ref * 0.7f);
Index: code/weapon/beam.h
===================================================================
--- code/weapon/beam.h	(revision 10819)
+++ code/weapon/beam.h	(working copy)
@@ -164,7 +164,6 @@
 	int bank;
 
 	int Beam_muzzle_stamp;
-	vec3d local_pnt;
 	int firingpoint;
 
 	float		beam_width;
beam_particles.patch (2,305 bytes)   

MageKing17

2014-06-15 08:25

developer   ~0015877

After performing slightly more surgery on the code, I've got behavior that seems to behave identically to the old code with regular beam turrets, and seems to work similarly for the test ship.

The_E

2014-06-16 15:57

administrator   ~0015884

Committed in revision 10824

Issue History

Date Modified Username Field Change
2014-06-15 02:18 Axem New Issue
2014-06-15 07:44 MageKing17 Assigned To => MageKing17
2014-06-15 07:44 MageKing17 Status new => assigned
2014-06-15 08:05 MageKing17 File Added: beam_particles.patch
2014-06-15 08:14 MageKing17 Note Added: 0015876
2014-06-15 08:14 MageKing17 Status assigned => feedback
2014-06-15 08:24 MageKing17 File Deleted: beam_particles.patch
2014-06-15 08:24 MageKing17 File Added: beam_particles.patch
2014-06-15 08:25 MageKing17 Note Added: 0015877
2014-06-15 08:25 MageKing17 Status feedback => code review
2014-06-16 15:57 The_E Status code review => assigned
2014-06-16 15:57 The_E Note Added: 0015884
2014-06-16 15:57 The_E Status assigned => resolved
2014-06-16 15:57 The_E Resolution open => fixed