Hi guys
Ive been working on a ribbon trail or sword slash effect following certain instructions(link below) and have been using
the extended xna skinning sample as a platform for experimentation, so far Im just using a small triangle strip for testing
purposes. I feel as though Im pretty close but Im stuck at the placement of the strip rotation wise,right now the strip is sitting
in a vertical position parallel to the forearm(picture below) and what I would like to do is rotate the strip in a horizontal position if anyone has any advice on how this would done it would be much appreciated.
Thankyou
link to instructions by jwatte
http://xboxforums.create.msdn.com/forums/p/82905/500482.aspx#500482
extended skinning sample link
http://xbox.create.msdn.com/en-US/education/catalog/tutorial/skinned_model_extensions
picture of strip
[attachment=18037:9 23 2013 8 50 59 PM.jpeg]
bone location code below
Vector3 position ;
/// <summary>
/// Draws the baseball bat.
/// </summary>
void DrawBaseballBat1(Matrix view, Matrix projection)
{
int handIndex = skinningData.BoneIndices["L_Forearm"];
Matrix[] worldTransforms = animationPlayer.GetWorldTransforms();
// Nudge the bat over so it appears between the left thumb and index finger.
batWorldTransform1 = Matrix.CreateTranslation(position) *
worldTransforms[handIndex];
}
drawing code
//draw triangles
device.RenderState.CullMode = CullMode.None;
basicEffect.World = batWorldTransform1 ;
basicEffect.View = view;
basicEffect.Projection = projection;
basicEffect.VertexColorEnabled = true;
basicEffect.Begin();
foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
{
pass.Begin();
device.VertexDeclaration = myVertexDeclaration;
device.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, vertices, 0, 10);
pass.End();
}
basicEffect.End();
triangle strip code
public bool InitVertices()
{
myVertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
vertices = new VertexPositionColor[12];
if (animationPlayer.currentTimeValue < TimeSpan.FromMilliseconds(24))
{
vertices[11] = new VertexPositionColor(new Vector3(-5, 1, 1) , Color.Red);
vertices[10] = new VertexPositionColor(new Vector3(-5, 5, 1) , Color.Red);
}
if (animationPlayer.currentTimeValue < TimeSpan.FromMilliseconds(44))
{
vertices[9] = new VertexPositionColor(new Vector3(-3, 1, 1), Color.Red);
vertices[8] = new VertexPositionColor(new Vector3(-3, 5, 1) , Color.Green);
}
if (animationPlayer.currentTimeValue < TimeSpan.FromMilliseconds(64))
{
vertices[7] = new VertexPositionColor(new Vector3(-1, 1, 1), Color.Green);
vertices[6] = new VertexPositionColor(new Vector3(-1, 5, 1), Color.Green);
}
if (animationPlayer.currentTimeValue < TimeSpan.FromMilliseconds(84))
{
vertices[5] = new VertexPositionColor(new Vector3(1, 1, 1), Color.Orange);
vertices[4] = new VertexPositionColor(new Vector3(1, 5, 1), Color.Orange);
}
if (animationPlayer.currentTimeValue < TimeSpan.FromMilliseconds(104))
{
vertices[3] = new VertexPositionColor(new Vector3(3, 1, 1), Color.Orange);
vertices[2] = new VertexPositionColor(new Vector3(3, 5, 1), Color.Yellow);
}
if (animationPlayer.currentTimeValue < TimeSpan.FromMilliseconds(124))
{
vertices[1] = new VertexPositionColor(new Vector3(5, 1, 1)* position1, Color.Yellow);
vertices[0] = new VertexPositionColor(new Vector3(5, 5, 1)* position, Color.Yellow);
}
return false;
}