University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

Getting the position of a joint at the end of a motion | General SmartBody Discussion | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Getting the position of a joint at the end of a motion
July 24, 2014
11:37 am
Avatar
Member
Members
Forum Posts: 10
Member Since:
April 30, 2014
sp_UserOfflineSmall Offline

Hi !

All is in the title. This is what I have one so far, but this doesn't seem to work.

float duration = motion->getDuration();
int nbFrames = motion->getNumFrames();
SrVec lastPos = motion->getJointPosition(skeleton->getJointByMappedName("base"), (duration / nbFrames) * (nbFrames - 1));

The motion is ChrUtah_Walk001 and skeleton is an instance of a skeleton actually having a joint named "base". lastPos value is always (0, 0, 0). I am not sure this is what I should get in return. Concretely, I want to know the position the joint will theoretically have at the end of the motion, but without having to execute it on a character.

Céline

July 27, 2014
10:08 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Ah, yes, I see the problem. The motion files are essentially data, and although you can query for those bits of data ("what is the rotational value of the base joint at time 1.4?") 

 

So if you want to know the joint position as it is associated with a skeleton, use the getJointPosition() function as you have tried.

Otherwise, try one of the following instead:

SrQuat quat = motion->getChannelQuat("base", time);

SrMat mat = motion->getChannelMat("base", time);

SrVec pos = motion ->getChannelPos("base", time);

 

Let me know if that works for you.

 

Ari

July 28, 2014
1:17 pm
Avatar
Member
Members
Forum Posts: 10
Member Since:
April 30, 2014
sp_UserOfflineSmall Offline

Thank you very much ! I will try this and tell you if it works.Céline

July 30, 2014
8:19 am
Avatar
Member
Members
Forum Posts: 10
Member Since:
April 30, 2014
sp_UserOfflineSmall Offline

Hello !

The one with SrVec worked for me :)
I didn't had to try the others.

Céline