Seba
Member
|
Skeleton
In character, skeleton is automatically joined with mesh. How join skeleton with mesh. I create extend structure. Have mesh, CSkeleton, but i can't move skeleton to mesh. I see skeleton in center of the map and i can move mesh to skeleton but can't move and attach skeleton to mesh.
|
|
08-05-2010 10:13 PM |
|
Esenthel
Administrator
|
RE: Skeleton
I don't understand, please try look in tutorials "animation"
if that wont help please paste your codes
|
|
08-05-2010 10:23 PM |
|
Seba
Member
|
RE: Skeleton
Ok i look to tutorials and now i found the solution. Srry fo trouble. My mistake.
|
|
08-05-2010 10:49 PM |
|
Seba
Member
|
RE: Skeleton
1) I have skeleton in my Item. I create it using this code:
Quote:skeleton->create(*obj.skeleton());
Then i wan't to transforme one bone from character skeleton using this skeleton. I use to this transformation that code in Player::update():
Quote: if(inv.slot[SLOT_ARM_R].valid())
{
if(OrientP *weapon=inv.slot[SLOT_ARM_R]().skeleton->findPoint("secondHand"))
{
cskel.clear();
cskel.transformInWorldSpace(cskel.findBoneI("HandL"),Matrix().setPos(weapon->pos)/*.setPosDir(weapon->pos,weapon->perp,weapon->dir)*/,true);
//cskel.updateMatrix(matrix())
//.updateVelocities();
}
}
But this bone from character is in different position than point in my item skeleton.
2) When i draw Item::skeleton i didn't see it with mesh. Did i need transform it manually?
3) Why if i have Item in hand the update function didn't run?
|
|
08-06-2010 08:42 PM |
|
Esenthel
Administrator
|
RE: Skeleton
did you look at Bloody Massacre? there's holding items in hand, and adjusting the bones matrixes
|
|
08-07-2010 12:10 PM |
|
Seba
Member
|
RE: Skeleton
I look i have item placed in hand like in BM. But i have skeleton in my ITEM, and i need position of one point in this skeleton to try put second hand in this position. But when i get point position and update Chr::cskel the hand didn't go to the correct position. Hand is placed in different position.
Quote: if(OrientP *weapons=weapon.cskel.findPoint("secondHand"))
{
cskel.clear();
cskel.transformInWorldSpace(cskel.findBoneI("HandR"),Matrix().setPos(weapons->pos),true);
}
cskel.updateMatrix(ctrl.actor.matrix()) // update all matrixes
.updateVelocities(); // update all bone velocities
When i use code to place bullet nothing change. Hand is in the same position.
|
|
08-07-2010 02:10 PM |
|
Seba
Member
|
RE: Skeleton
Ok i made some improvements but i don't know why
Quote:void PLAYER::animateUpdateMatrix(Matrix &body_matrix)
Didn't executed. In BM I didn't found any external code to make it work.
|
|
08-07-2010 06:34 PM |
|
Driklyn
Member
|
RE: Skeleton
(07-07-2010 10:32 PM)Esenthel Wrote: -IMPORTANT: Vec, Matrix and other mathematical objects are now passed as "const type &x" (instead of old "type &x") to comply with GCC compiler for upcoming Mac/iPhone/iPad ports (please revise your codes, especially custom game object classes and their virtual method overriding to match parameter declarations as in base class methods)
You're missing the const. Same thing happened to me when it got changed.
Code:
void PLAYER::animateUpdateMatrix(C Matrix &body_matrix)
|
|
08-07-2010 07:54 PM |
|
Seba
Member
|
RE: Skeleton
This work now. But i can't transform Player::cskel HandL to place where Item::skeleton point is. I use this code any advice?
Quote: if(inv.slot[SLOT_ARM_R].valid())
{
if(SkelPoint *point33=inv.slot[SLOT_ARM_R]().skeleton->findPoint("secondHand"))
{
Vec skelPos;
skelPos=point33->pos/**inv.slot[SLOT_ARM_R]().matrixScaled()*/;
cskel.clear();
cskel.transformInWorldSpace(cskel.findBoneI("HandL"),Matrix().setPos(skelPos),true);
}
}
This code is placed in:
Quote:void PLAYER::animateUpdateMatrix(C Matrix &body_matrix)
|
|
08-07-2010 09:33 PM |
|
Seba
Member
|
RE: Skeleton
How to use:
Quote:cskel.transformInWorldSpace(sac.hand_l,transform,true);
I want to transform position of the bone by position of my point in Item::skeleton. The point is in good position but hand don't want to move to that point why?
Use that code:
Quote: if(SkelPoint *point33=inv.slot[SLOT_ARM_R]().skeleton->findPoint("secondHand"))
{
skelPos=point33->pos*inv.slot[SLOT_ARM_R]().matrixScaled();
Matrix transform; transform.setPos(skelPos);
cskel.transformInWorldSpace(sac.hand_l,transform,true);
}
Placed in:
Quote:void PLAYER::animateUpdateMatrix(C Matrix &body_matrix)
(This post was last modified: 08-08-2010 09:43 PM by Seba.)
|
|
08-08-2010 09:42 PM |
|
Esenthel
Administrator
|
RE: Skeleton
paster your full code of void PLAYER::animateUpdateMatrix(C Matrix &body_matrix)
check in debugging if
skelPos=point33->pos*inv.slot[SLOT_ARM_R]().matrixScaled();
Matrix transform; transform.setPos(skelPos);
cskel.transformInWorldSpace(sac.hand_l,transform,true);
gets executed
|
|
08-09-2010 10:05 AM |
|
Seba
Member
|
RE: Skeleton
Now i placed red dot in right position. But hand didn't transform to that place.
|
|
08-09-2010 05:02 PM |
|
Esenthel
Administrator
|
RE: Skeleton
if(SkelPoint *point=inv.slot[SLOT_ARM_R]().skeleton->findPoint("secondHand"))
{
skelPos=point->pos*inv.slot[SLOT_ARM_R]().matrixScaled();
Matrix transform; transform.setPos(skelPos);
cskel.transformInWorldSpace(sac.arm_lu,transform,true);
}
is this causing the error?
'transform' is relative transformation to apply on already animated bone, it's a little bit more complex then set position and expect the bone would go there
|
|
08-09-2010 07:25 PM |
|
Seba
Member
|
RE: Skeleton
This part of code works but transformation that is used there didn't put hand in right position.
Quote:it's a little bit more complex then set position and expect the bone would go there
Any advice, or i have to try all idea i have?
I want make Inverse Kinematics using that function.
|
|
08-09-2010 07:36 PM |
|