Game Development Community

Sword Trails

by John Eric Miller · in Torque Game Engine · 03/15/2004 (7:24 pm) · 40 replies

Does anyone have any ideas on how I could have sword trails when a sword is swung?
Page«First 1 2 Next»
#21
11/03/2004 (12:34 am)
Called in:

void ShapeBase::updateImageState(U32 imageSlot,F32 dt)

Body is located in: shapeImage.cc

BTW: You can simply do a file search on your sources, to find out about such stuff ;)
#22
11/03/2004 (8:59 pm)
Ah thanks for the info, must have fat fingered a wrong letter into my search. late night coding
#23
07/14/2005 (5:59 am)
Hey huys;
you are all talking about sword trails .
i would love to participate in this conversation but the funny thing is that i do not enen have the sword implemented in my engine. :) :p
can anyone post the .h , .cc and .cs files ??
thank you in advance .
#24
10/10/2005 (2:05 am)
Can anyone please send me these files:
- motion.h
- motion.cc
- /math/mCatmullRomPatch.h
- /math/mCatmullRomPatch.cc

I can't seem to connect to the CVS Server

You can mail it to burning at webmail d0t co d0t za

Thanx in advance!
#25
11/20/2005 (9:50 pm)
I also try implementing but its not working i added

- motion.h
- motion.cc
- /math/mCatmullRomPatch.h
- /math/mCatmullRomPatch.cc

and also modify the shapebase.h , shapeimage.cc and consoletype.h
. When i first included the motiontrailData without recompling the codei got console error but after modifying and compling console is not giving me error but i can't see the motion trail when i try to exexute my script using relamcraft.exe it working prefectly.

Any idea.
#26
11/20/2005 (11:07 pm)
Now i am getting these 2 console error when i try to use sowrd.dts and my game exit.

control/data/models/sword.dts - Collision mesh names should start with Col or LOSCol, encountered 'damageStart' in detail level 3
control/data/models/sword.dts - Collision mesh names should start with Col or LOSCol, encountered 'damageEnd' in detail level 3


but if i use crossbow or any other wepon its working fine.
Plz help me out
#27
11/20/2005 (11:09 pm)
Anyone... pleasee.... mail me these files...
#28
11/20/2005 (11:22 pm)
Another item that needs to go into TDN.
#29
11/21/2005 (9:38 am)
You can ignore these two erros:
Quote:
control/data/models/sword.dts - Collision mesh names should start with Col or LOSCol, encountered 'damageStart' in detail level 3
control/data/models/sword.dts - Collision mesh names should start with Col or LOSCol, encountered 'damageEnd' in detail level 3

Basically this are not errors, this are warnings.
The sword trail needs two custom nodes in your weapon, that define the start and end point of of the trail to generate. These two nodes are only used for sword trails and are not wired into the collision mesh. So it is safe to ignore these errors.

Okay. I assume you have made all the engine modifications, so that everything compiles and you you double checked, that the four files, mentioned above are actually added to your project.

Next step is to setup your scripts corretly.
First of all make sure you have a MotionTrailData datablock defined in a script file, that is compiled with your weapon definition or before it.
E.g.
datablock MotionTrailData(AxeTrail)
{
    // Destination blending
    // 0 =	GL_ZERO,
    // 1 =	GL_ONE,
    // 2 =	GL_SRC_COLOR
    // 3 =	GL_ONE_MINUS_SRC_COLO
    // 4 =	GL_SRC_ALPHA
    // 5 =	GL_ONE_MINUS_SRC_ALPHA
    // 6 =	GL_DST_ALPHA
    // 7 =	GL_ONE_MINUS_DST_ALPHA

    // Source blending
    // 0 =	GL_ZERO,
    // 1 =	GL_ONE,
    // 4 =	GL_SRC_ALPHA
    // 5 =	GL_ONE_MINUS_SRC_ALPHA
    // 6 =	GL_DST_ALPHA
    // 7 =	GL_ONE_MINUS_DST_ALPHA
    // 8 =  GL_DST_COLOR
    // 9 =  GL_ONE_MINUS_DST_COLOR
    // 10 = GL_SRC_ALPHA_SATURATE
    srcBlend = 4;
    dstBlend = 5;
    lifetime = 0.2;
    curveDetail = 0.05;      // Small values produce a high curve tesselation
                             // High values produce a low curve tesselation

    numberOfQuads = 100;    // Number of quads, used to render the trail

    showAlways = false;     // Trail is only shown during attack move
                            // If showAlways is set to true the trail will be
                            // rendered all the time

    color = "0.855 0.855 0.855 0.20";   // Color or the trail

    trailTexture =  "rw/data/fx/motionTrail" ; // Alpha texture of the trail
};


The next thing is to attach the motion trail definition to your weapon.

You have to add a property motionTrail to the ShapeBaseImageData datablock of your meele weapon and make it point to your previously defined MotionTrailData datablock.

E.g.

datablock ShapeBaseImageData(AxeImage)
{
...
  // Motion Trail
   motionTrail = AxeTrail;
...
}

If this is all done, make sure the trailTexture in your MotionTrailDataBlock is pointing to an existing texture. The texture must contain an alpha channel, so best test with the motion trail texture from the RW cvs.

If it still does not work, check the console for warnings, about:
1. the motion trail texture not being found
2. the motion trail datablock of your weapon is not being found (maybe a typo)
3. Debug your code and place a breakpoint in MotionTrail::renderObject and MotionTrail::renderTrail to see, if the trail is rendered, but maybe not visible.

-- Markus
#30
11/23/2005 (2:00 am)
I have done each and everything perfectly i checked it twicely but my game crash but when i run the program with RealmWar.exe its working perfectly
any idea
#31
11/23/2005 (8:02 am)
Is realmwars still in CVS? I can log in but the realmwars module is not found?

Thanks
Todd
#32
11/23/2005 (11:17 am)
Vishal, can you give some more information about your crash?

- Post the console.log
- Show the message box you get
- Show the stacktrace you get when running in the debugger.

-- Markus
#33
05/27/2009 (12:21 pm)
hey, sorry bumping this old thread, but did anyone get this to work in tgea 1.7.1 ? i tired to get the files, but i couldnt find them, if someone could send them to me, that would be great.

thanks everyone
#34
01/10/2011 (7:21 pm)
Bump

Need the files for the sword trails... anyone please?

EDIT:
nevermind... Mr. Hall helped me out here
#35
01/10/2011 (7:43 pm)
Look here for the old RW sword/motion trail.
#36
02/07/2011 (5:39 pm)
Hmm... helpful for those who have T3D, which I don't yet. ;)

I did manage to get ahold of the files referenced in the above thread through a colleage who does have access to that forum, but the puzzle is still incomplete. I've yet to be able to piece together the rest of the code changes originally implented in ShapeBase.cc/h and ShapeImage.cc by RW. Anyone have any ideas?
#37
02/09/2011 (1:22 pm)
Not for T3D...its from RW

I had everything setup(in 1.5.2) except for a new function in ShapeBase checking the vecStart, vecEnd positions and passing it back to the updateImage function. I was trying to force the function call in a way that wasn\'t working...my lack of C++ know-how... But call your new ShapeBase function UpdateImageMotionTrail from UpdateImageState. That should get you rolling in the right direction.

Big thanks to Thomas Huhn for helping me out!
#38
02/11/2011 (4:40 am)
Right, I meant the fact that the code is in a private thread for those who own a license to T3D, which I don't. :D

And, like you, I'm working on getting it implemented in TGE 1.5.2. I've worked on my own methods for motion trails for some time but I'm not able to get them to properly give me alpha and I'm certainly nowhere near to getting them beautified or rendering on a spline.

I guess I'll ask my friend to scour that thread again, because all I got from him was motion.cc/.h and that pair of patched math.cc/.h files referenced above. I didn't get a shapebase function called UpdateImageMotionTrail... or any other code/functions whatsoever. (i.e., no updated ShapeBase resources, etc...) So I had nothing to search through for the RW--> <--RW commented code. It's possible he missed it since I couldn't be very clear on what I was looking for since I've never seen the resource before. Heh.

Thanks.
#39
02/14/2011 (6:22 am)
Yeah, that function isn't anywhere in the threads. Thomas Huhn had to send it to me, it's out of old RW code I believe.
email me jeremy at act7gaming dot com and I'll send you what Thomas sent to me and how I setup everything up to get it working in 1.5.2
The only problem you'll run into is the on/off functionality... that is, when swinging versus rendering all of the time. I found the answer to that in player.cc using the armthread animation. A bit of a hack, but you might find a better alternative.
#40
12/11/2012 (2:14 pm)
Anyone have this working in T3D? I've dug on it a bit, but I don't understand the new gfx. Does anyone have a port or know how to get it working?
Page«First 1 2 Next»