know vertex x#,y#,z# in animating mesh

Blitz3D Forums/Blitz3D Programming/know vertex x#,y#,z# in animating mesh

RGF(Posted 2009) [#1]
I'm trying to create weapon trails: when my player swings his sword from side to side, a "ghost" trail should appear right after the blade, and then fade away in a few millisecs.

I've found in the code archives some piece of code, which creates a trail after a vehicle, by using the method of drawing a surface between two entities: the program obtains their respective positions, then draws the trail right after both objects, then continues drawing the trail longer and longer...

So, this program, which runs perfectly and smoothly, requires two entities, with different positions, to start drawing a trail.

The problem is: my player's model is an animated b3d entity. When I try to create and add two meshes to this model, near the beginning and the end of the sword's blade, they won't animate with the sword. Of course the generated trail does not follow sword path.

The question is: Is there a reasonable way two objects can be positioned, in real time - while animation is playing, in the beginning and at the end of the sword blade?

Otherwise, is there a way of knowing a vertex x,y,z (global position) in realtime, if this vertex is part of an animated model (.b3d), and the model is animating?

Thank you


Gabriel(Posted 2009) [#2]
Ignore vertices and use the bones instead. The hand (or finger) bone can be used for one end of the sword and then put another bone in for the end of the sword. To calculate vertices would require a number of matrix multiplications, and wouldn't be worth it.

You can get Bones ( as entities ) by using FindChild.


RGF(Posted 2009) [#3]
Thank you, now is working


Ross C(Posted 2009) [#4]
If you really must know these things, and your sure the vertex is only affected by one bone, you can get the global position by parenting a pivot to the bone, and positioning the pivot to the vertex's x,y,z position in the first pose. [EDIT] - the pivot should follow the vertices x,y,z


RGF(Posted 2009) [#5]
Thanks Ross C, that's a brilliant idea!