Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Weapons and objects.; How do you hold them?
Topic Started: Sep 27 2007, 09:55 PM (665 Views)
NEED HELP sorta
Member
[ *  * ]
I've been wondering, is there a way to get the current rotation of a given bone and get a x,y,z world space coordinate of where that bone is at?
I'm wondering because I'd like to have my characters hold random objects and things in there hands and put on different clothes and things like that.

I know there is
Code:
 

GetBoneTransformation(OutputMatrixID, BoneIndex)

But what does that return exactly?
It says it returns a matrix, but how can I use a matrix to get the coordinates I want?

The manual says:
Quote:
 

This function copies the bone to world space transformation matrix of the given bone of the object that calls this function to the given output matrix.

But I wouldn't know how to go about using it's information.

What do you know about this?

Edit:
Darnit!
Sorry, I wasn't paying close enough attention to where I posted this, I thought I was in a different subforum.
Offline Profile Quote Post Goto Top
 
Rixeno
Member Avatar
Teo-Carliss
[ *  *  *  *  * ]
Yeah, this should probably be moved ;) :P ^_^ ....
Report spam the nanosecond you see it.
Ninjas are everywhere, for all you know there are eleven behind you right now, including me...
Offline Profile Quote Post Goto Top
 
NEED HELP sorta
Member
[ *  * ]
Yeah, I've already reported requesting a move.
Anyway, do you have any hints? :rolleyes:
Offline Profile Quote Post Goto Top
 
$pecter
Member Avatar
Elite Member
[ *  *  *  * ]
Perhaps this topic could help.
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
NEED HELP sorta
Sep 27 2007, 09:55 PM
I've been wondering, is there a way to get the current rotation of a given bone and get a x,y,z world space coordinate of where that bone is at?

To retrieve coordinates from a matrix, you need to transform the null vector <0,0,0> with it and then use GetVector(...) to obtain x/y/z from it. To get the rotx/y/z angles from the matrix, you can use ComputeMatrixRotationAngles(...):
Code:
 
var BoneMatrix,TransformationVector;

//copy the bone transformation matrix
BoneMatrix=GetBoneTransformation(-1,BoneIndex);
//create the null vector
TransformationVector=CreateVector(-1,0,0,0);
//make the vector point at the coordinates of the bone
TransformVector(TransformationVector,TransformationVector,BoneMatrix);
//retrieve the bone coordinates
x=GetVector(TransformationVector,1);
y=GetVector(TransformationVector,2);
z=GetVector(TransformationVector,3);
//retrieve the bone orientation from its matrix
ComputeMatrixRotationAngles(TransformationVector,BoneMatrix);
rotx=GetVector(TransformationVector,1);
roty=GetVector(TransformationVector,2);
rotz=GetVector(TransformationVector,3);

ReleaseMatrix(BoneMatrix);
ReleaseVector(TransformationVector);


NEED HELP sorta
Sep 27 2007, 09:55 PM
I'm wondering because I'd like to have my characters hold random objects and things in there hands and put on different clothes and things like that.

Then this topic might offer some help (especially my last post ;) ), as it seems to deal with a similar problem.
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
NEED HELP sorta
Member
[ *  * ]
Thanks!
That all helps a tremendous amount.

Your code there is all I needed MysteriXYZ, thanks very much.
The only problem is that in this case I drew a little wall and the arm rotates one direction and the wall the other direction like this.

| arm
| wall

/ arm
\ wall

\ arm
/ wall

I can tell I need to reverse one of the rotations I suppose, so I'll keep trying.

Edit:
LOL, that was as easy to fix as I thought it would be. :)
Anyway, thanks a lot for that.
Now all I have to do is figure out how to get the animations to run smoothly instead of jumping on the seams.
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply