About Store Forum Documentation Contact



Post Reply 
Bone points translation
Author Message
Dynad Offline
Member

Post: #1
Bone points translation
Hey,

Ive a problem with translating points/bones. Ive made an item with enum weapon. I added a skeleton to weapon with 2 points and 1 bone.

When i try to use this:

PHP Code:
OrientP &wepPlayers[0].cskel.getPoint("HandR");
    
skel->getBone("main").setPosDir(wep.poswep.dir); 

The only thing that moves is the point and not the mesh. When i try to move a bone i get same result.

Is there another solution to translate a mesh based on 2 points?


Thnx,
~Dynad

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 05-29-2010 04:35 PM by Dynad.)
05-29-2010 01:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Bone points translation
This is what I am using.

Code:
if (OrientP *hand = Players[0].cskel.findPoint("HandR")) {
    matrix(Matrix().setPosDir(hand->pos, -hand->cross(), hand->dir));
}
05-29-2010 06:07 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #3
RE: Bone points translation
Thnx, yes that works indeed but its not perfectly aligned with the hand.. Do i have to change the HandR point? or is there an easier way?

When i have different kind of weapons the size will change also. Then the only solution i can think off is the edit the hand->pos to make it work with more then 1 weapon.

There is always evil somewhere, you just have to look for it properly.
05-29-2010 06:54 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: Bone points translation
I haven't figured out how to align the mesh to a certain point instead of just the center of the mesh, but you can offset the position by replacing hand->pos with the line below and adjusting the multipliers to your liking.

Code:
//          X offset             Y offset            Z offset
hand->pos + hand->perp * 0.015 + hand->dir * 0.025 - hand->cross() * 0.05

For multiple weapons, you would just need to change the multipliers based upon which weapon is currently being held.
05-29-2010 09:09 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #5
RE: Bone points translation
Ah thnx ill try this out smile

There is always evil somewhere, you just have to look for it properly.
05-29-2010 11:50 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Bone points translation
I usually just move the mesh in Mesh Editor so the "handle" is located at Vec(0,0,0) position.
You can always make a skeleton point in the weapon skeleton, place the point on the mesh handle location, then in the codes draw the mesh translated by the skeleton handle point of the weapon.
05-30-2010 12:11 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #7
RE: Bone points translation
Yes that was my first choice but i will try both.

There is always evil somewhere, you just have to look for it properly.
05-30-2010 03:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #8
RE: Bone points translation
(05-30-2010 12:11 PM)Esenthel Wrote:  I usually just move the mesh in Mesh Editor so the "handle" is located at Vec(0,0,0) position.

That's what I was thinking of doing; sounds easiest.

(05-30-2010 12:11 PM)Esenthel Wrote:  You can always make a skeleton point in the weapon skeleton, place the point on the mesh handle location, then in the codes draw the mesh translated by the skeleton handle point of the weapon.

Couldn't quite figure this out when I was trying to do it earlier...
05-30-2010 08:48 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #9
RE: Bone points translation
(05-30-2010 12:11 PM)Esenthel Wrote:  You can always make a skeleton point in the weapon skeleton, place the point on the mesh handle location, then in the codes draw the mesh translated by the skeleton handle point of the weapon.

(05-30-2010 12:11 PM)Driklyn Wrote:  Couldn't quite figure this out when I was trying to do it earlier...

Yes im trying this right now, but i cant get it to work what i want, for a handgun its not really needed... but for a rifle u need 2 hands and im not sure how to handle it like that every weapon is in the correct position...
Ok well when i try to translate the gun at skeleton point of the weapon, but thats not working... the weapon stays in the center of the Human hand bone point.

in update:
PHP Code:
if (OrientP *handR Players[0].cskel.findPoint("HandR")) {

matrix(Matrix().setPosDir(handR->pos, -handR->cross(), handR->dir));
    } 

in draw:
PHP Code:
OrientP &wepLItems[0].skel->getPoint("HandR");
Items[0].mesh->draw(Matrix(wepL)); 

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 05-30-2010 09:41 PM by Dynad.)
05-30-2010 08:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply