• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
ankhd

Bone Rotation Madness

4 posts in this topic

Hi there.

 

If my skinned mesh has animation but the animation only applies its default pose, I can rotate the bone fine.

but if the skinned mesh has no animation the rotation goes like the tile say's it rotates fast and I cant even slow it down when I override

the time delta td = 0.0009.

the thing is if I applie just a rotation Like 45 degrees  it still rotates 360 degrees over and over but it is rotating on the axis Im rotating it on

like this

Angle[ctr] = 45.0;

D3DXMatrixRotationY(&mSpin D3DXToRadian(Angle[ctr]));

D3DXMatrixIdentity(&temp);

temp *= mSpin;

temp *= Frame[ctr]->TransformationMatrix;

Frame[ctr]->TransformationMatrix = temp;

 

//when the mesh has animation but not affecting the bone it works but spins out of control when no animation.

 

any ideas on what it could be I need to do.

 

I could applie default animations that'll fix it.

0

Share this post


Link to post
Share on other sites

First, I don't know DX10 well at all, so I can only speak in general terms.

 

Just for general info, what algorithm are you using for animating the mesh? Microsoft's (e.g., their skinning example)? Luna's?

 

This is just a guess, but I had a similar problem, years ago. The animation controller (whatever routine updates the matrixes during animation) uses the transformation matrix from the previous frame. That's just how the animation data was set up. If that's the case for whatever algorithm you're using, when you add a rotation to the frame, that rotation gets added every new frame, making it spin faster and faster.

 

As mentioned, it was years ago, but I think my solution was to add a D3DXMATRIX baseMatrix to the Frame structure and make a copy of each frame's base matrix after it was loaded. Then, rather than updating the frame transform itself, I set the frame matrix to the base matrix X rotation matrix. Not knowing your algorithm, that may not work.

 

// each frame

Frame[ctr]->TransformationMatrix = Frame[ctr]->baseMatrix * mSpin;

 

By the way, you can probably multiply matrices directly. I.e., rather than:

 

temp *= Frame[ctr]->TransformationMatrix; Frame[ctr]->TransformationMatrix = temp;

 

you can just use:

 

Frame[ctr]->TransformationMatrix = mSpin * Frame[ctr]->TransformationMatrix;

Edited by Buckeye
1

Share this post


Link to post
Share on other sites

Hi.

I'm using Key frame animation from jim adams book Advanced Animation with DirectX.

 

I tryed to apply the Original matrix and inversed but it just puts the bone in the centre of the mesh but rotates how it should.

and not inversed

 

like this in update animation



// Reset transformation

D3DXMatrixIdentity(&Anim->Bone->TransformationMatrix);




// Scaling


if(Anim->ScaleKeys ) 

{


// Loop for matching scale key


// Get 2nd key number


// Get difference in keys' times


// Calculate a scalar value to use


// Calculate interpolated scale values


// Create scale matrix and combine with transformation


Anim->Bone->TransformationMatrix *= matScale;

}


// Rotation


if(Anim->RotationKeys ) 

{


// Loop for matching rotation key



// Get 2nd key number


// Get difference in keys' times


// Calculate a scalar value to use


// slerp rotation values


// Create rotation matrix and combine with transformation




Anim->Bone->TransformationMatrix *= mInvmatRotation;

// matRotation;

}


// Translation


if(Anim->TranslationKeys ) 

{


// Loop for matching translation key


// Get 2nd key number


// Get difference in keys' times

a scalar value to use


// Calculate interpolated vector values


// Create translation matrix and combine with transformation


Anim->Bone->TransformationMatrix *= matTranslation;

}


// Matrix


if(Anim->MatrixKeys ) 

{


// Loop for matching matrix key

DWORD Key1 = 0, Key2 = 0;



// Calculate a scalar value to use



// Combine with transformation

Anim->Bone->TransformationMatrix *= matDiff;

}

}


// Go to next animation

Anim = Anim->m_Next;

}

0

Share this post


Link to post
Share on other sites

Unfortunately, I'm not familiar with Adams' book so I'm not sure how he implements the animation controller.

 

However, try applying the rotation matrix for a single rendering pass, not every frame. Something like:


UpdateScene(deltaTime); // calculate bone frame animation transforms

if( doRotation ) 
{
   // I assume "ctr" is the bone number for the desired bone.
   [calculate mSpin]
   Frame[ctr]->TransformationMatrix = mSpin * Frame[ctr]->TransformationMatrix;
   doRotation = false;
}
RenderScene();

That may demonstrate whether the last frame transform is used for the next one.

Edited by Buckeye
0

Share this post


Link to post
Share on other sites

I'm just going to set 2 key frames on meshes that dont have animation now.

Most of the meshes will be animated anyway. I did try but the time factor to find the correct trans out ways the need .

Thanks for your help.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0