Ogniok
Member
|
animateUpdateMatrix
I copied animateUpdateMatrix from BM, but it didn't work in my game. When I'm playing i get effect like this:
Function:
Code:
void Player::animateUpdateMatrix(Matrix &body_matrix)
{
__super::animateUpdateMatrix(body_matrix); //Call default setting skeleton matrix
Vec &desired_dir = cskel.getPoint("head").dir; //This is the desired weapon direction in world space
if(Inv.slot[playerData.activeWeapon].valid()) //If has item
{
if(OrientP *point = cskel.findPoint("HandR"))
{
Vec current_dir = point->cross(); //This is the current weapon direction in world space
Matrix3 transform;
transform.setRotation(current_dir, desired_dir, b_aim_r); //Create matrix which transforms current direction into desired direction
cskel.transformInWorldSpace(sac.arm_ru, transform); //Call this method to perform a world space transformation
}
}
}
When I'm not using animateUpdateMatrix function i get this:
I want player to hold item just like in BM.
|
|
03-26-2010 08:14 PM |
|
Esenthel
Administrator
|
RE: animateUpdateMatrix
check the orientation of your SkelPoint hand compared to the one in BM
|
|
03-26-2010 08:16 PM |
|
Ogniok
Member
|
RE: animateUpdateMatrix
I've added this:
Code:
if(slot[playerData.activeWeapon].valid())
{
if(OrientP *point = owner.cskel.findPoint("HandR"))
{
ItemEC &item = slot [playerData.activeWeapon]();
Matrix &matrix = slot_matrix[playerData.activeWeapon];
item.matrix(Matrix().setPosDir(point->pos, point->dir, point->cross())); //Set new matrix
//item.matrix().rotateZ(180);
Vec vel, ang_vel;
GetVel(vel, ang_vel, matrix, item.matrix()); //Calculate velocities between old and new matrixes
item.setDrawingVelocities(vel, ang_vel); //Put the velocities to be used in motion blur drawing
matrix = item.matrix(); //Store new matrix
}
}
To Inventory::update function and I get this:
|
|
03-26-2010 08:32 PM |
|
Esenthel
Administrator
|
RE: animateUpdateMatrix
check it also in Mesh Editor (point orientation)
|
|
03-26-2010 09:32 PM |
|
Ogniok
Member
|
RE: animateUpdateMatrix
How I can do this?
|
|
03-26-2010 09:43 PM |
|
Esenthel
Administrator
|
RE: animateUpdateMatrix
launch mesh editor skeleton mode
and check if the skeleton hand point orientation has the same directions as the one from latest version of BM (check also the tiny perpendicular line)
|
|
03-26-2010 11:53 PM |
|
Ogniok
Member
|
RE: animateUpdateMatrix
They are not the same. How I can set the same orientation in Human model and Commando Babe?
|
|
03-27-2010 12:06 PM |
|
Esenthel
Administrator
|
RE: animateUpdateMatrix
editing is described in Mesh Editor documentation
Alt+RMB should rotate the point
|
|
03-27-2010 02:47 PM |
|