Game Development Community

*Half Solution*[BUG 1.0.1] Particle Data not saving correctly

by Rapid Fire · in Torque 3D Professional · 11/26/2009 (3:15 pm) · 1 replies

I've run into a few issues with the Particle Editor.

1) It's not saving a renamed file. When I change the name of a Particle or Emitter, and hit Enter, it still uses the old name as the parameter saved. This means I cannot move it off the name newParticle or newEmitter except through script changing. It also means I can only create 1 new particle at a time, and then have to restart the Editor.

2) If you set the Initial Speed of a particle to 10, and then close Torque and reload, it reloads the value to 0.982387. Setting it to 9.8 makes the reloaded value 0.565558. It is still marked as "10" (or it's actual saved value) in the saved Particle Data. For anyone checking this out, Intial Speed is saved as the variable inheritedVelFactor.

#1
11/27/2009 (4:15 pm)
I figured out the issue with #2.

in Pack and Unpack data in Particle.cpp the variable inheritedVelFactor is a 0 to 10 value, that is written as a 0 to 1 float. to fix:

in ParticleData::packData(BitStream* stream) change
stream->writeFloat(inheritedVelFactor, 9); to
stream->writeFloat(inheritedVelFactor/10, 9);

and in ParticleData::unpackData(BitStream* stream) change
inheritedVelFactor = stream->readFloat(9); to
inheritedVelFactor = stream->readFloat(9)*10;


Still working on the naming issues, but I assume it's something similar.