HeroEngine Forums

HeroEngine Support => Design & World Building => Topic started by: Legacy on May 03, 12, 05:11:17 AM

Title: [Resolved] Weapon trails?
Post by: Legacy on May 03, 12, 05:11:17 AM
Hello, my aim is to create trails behind melee weapons (like swords - see this video from Gothic: http://www.youtube.com/watch?feature=player_detailpage&v=rqGbyoz7HvM#t=19s (http://www.youtube.com/watch?feature=player_detailpage&v=rqGbyoz7HvM#t=19s)). I checked the particle effects and it is indeed possible to have a trail behind a particle but I am struggling with the very basic setup of this. COuld anyone point me in the right direction?
Thanks

EDIT: I just found the HSL trail functions on the particle effects page. I will try to experiment with that. Was not immediately apparent you can use trails without particles :)
Title: Re: Weapon trails?
Post by: jcsmith562 on May 03, 12, 02:26:08 PM
In Hero's Journey if memory serves correct they had a cage around their weapon meshes and they particles from the cage using an addition to the FX system which would emit particles from the weapon cage.
Title: Re: Weapon trails?
Post by: FI-ScottZ on May 03, 12, 06:53:45 PM
Right, all you really need is to use a surface emitter (http://wiki.heroengine.com/wiki/Particle_Surface_Emitter) and specify the MeshFileName to indicate the shape it should take.

The "cages" in HJ Ref are modified versions of models such as weapons which do not have all of the geometry of the normal model.  For example if you want particles on an ax, if you use the ax model for the emitter shape the particles will be all over it.  If you want them only on the blade, you would create a model that is just the blade (its "cage") and use that for the shape of the emitter and then parent the emitter to the actual ax with the proper offset to align it correctly.

So, you can see use of the cages is optional.
Title: Re: Weapon trails?
Post by: HE-BENNETT on May 04, 12, 07:47:02 AM
The ax in the FPS demo works exactly how you just described :)
Title: Re: Weapon trails?
Post by: FI-ScottZ on May 05, 12, 03:33:48 PM
We have been trying to get an fx working for the emitter mesh attach.  So far we got to the point of being ready to call

     CustomizeParticleSpec(emitter, "MeshFileName", ourFileNamePath)

where ourFileNamePath is a path to a model asset in our repo.  Just prior to calling it we confirm that the emitter is of type EmitterMeshNode and confirmed the path via println.  The emitter works fine on its own, but when we use the CustomizeParticleSpec line, there is no particle effect visible.

We based our code on how HJFXUTILSClassMethods works in HJ Ref.  Still, I wonder if the tasks in the fx editor are not set properly.

I looked at the list of fx in HJ Ref, but there are so many.  My question is, do you know of one that works and uses the emitter mesh attach task so I can take a look at that?
Title: Re: Weapon trails?
Post by: FI-ScottZ on May 05, 12, 03:55:21 PM
Update:

Wrote a test function in a client script:

Code: [Select]
public function EmitterSpec(input as String)
  tokens as List of String
  Tokenize(input, tokens)
  CustomizeParticleSpec(tokens[1], "MeshFileName", tokens[2])
.

In an area, I created an instance of a surface emitter.  With it selected, I can see the mesh it uses as a wireframe, and the particles come off it as they should.

I get the ID of it from the properties panel and use that in the above function call via the console to change the meshfilename.  I then see the wireframe change to the new mesh outline, but the particle freeze and no longer update.

It seems the emitter is being stopped, or something.  Any idea how to start it again?
Title: Re: Weapon trails?
Post by: HE-Cooper on May 05, 12, 05:55:17 PM
I migh be misunderstanding, but have you checked how the axe works in fps demo? I think that's what you are trying to do.
Title: Re: Weapon trails?
Post by: FI-ScottZ on May 05, 12, 09:53:16 PM
I hadn't looked at the FPS ref lately, but I see know that it uses blade_effect.prt in the AxePersistent fx, but that particle effect already has the meshfilename for the axe set beforehand.

The one we are trying to work like is specifically called "AdaptMeshEmitter", which is not in the FPS ref, and there appear to be no calls to CustomizeParticleSpec() anywhere in the FPS code.

I did find just now that the Shaman Nature's Hate fx uses the AdaptMeshEmitter task.  I'll try comparing that fx and the emitter to ours, as well as trying ours with different emitters.
Title: CustomizeParticleSpec bugged?
Post by: FI-ScottZ on May 07, 12, 05:39:59 PM
I am now wondering if this might be a bug.  I started with a much simpler set up as an experiment.  Perhaps someone from Idea Fabrik can try this and confirm.

After reading the Particle Surface Emitter tutorial (http://wiki.heroengine.com/wiki/Particle_Surface_Emitter), this is what I did:


I found the one FX in HJ Ref (Nature's Hate) that uses the attach task which uses CustomizeParticleSpec in a similar way and it seems to play the effect fine when previewed.  However, I know that code is from an older version of the engine; for instance, it is still using the property name "GrannyFileName" instead of MeshFileName.

So I wonder if perhaps due to the changes that happened since, this function no longer works, at least not for MeshFileName.  Just on a lark I tried "GrannyFileName" as well, but no dice.  Furthermore, printing out the return value for that function call showed the first time it returns false, then true every time after that.