University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

Reaching | General SmartBody Discussion | Forum


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
December 11, 2015
11:12 am
Forum Posts: 24
Member Since:
June 22, 2015
sp_UserOfflineSmall Offline



I cannot quite get the raching going implemeting it in C++. So far I want my character just to grab witht eh right hand a certain object to which I manually attached a SBPawn. The reaching is triggered and some movement is started. However, I did something wrong so the whole body gets deformed in a strange way althought the hand reaches to the approximately correct position.

The position can be seen in this picture at:


I am not sure what goes wrong maybe something related to a wrong skeleton or a wrongly scaled motion. The Reach is initialized with:

SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
    SmartBody::SBReach* pReach = m_pReachManager->createReach(charname);
    SmartBody::SBSkeleton* pSkeleton = scene->getSkeleton("");
    //scene->addAssetPath("motion", "behaviorsets/reaching/motions/");
    std::vector<std::string> vecMotionNames;



    std::string skelName = scene->getCharacter(charname)->getSkeleton()->getName();

    for(int i=0; i<vecMotionNames.size(); i++){
        SmartBody::SBMotion* pMotion = scene->getMotion(vecMotionNames[i]);
            vstr::errp()<<"Motion: "<<vecMotionNames[i]<<" not loaded correctly!"<<std::endl;
        pReach->addMotion("right", pMotion);


and the motion is triggered with this bml command:

"<sbm:reach sbm:action=\"grab\" target=\""+pTarget->getName()+"\" sbm:reach-finish=\"false\" sbm:reach-duration=\"2\"/>";

Do you have any ideas what I did wrong or where I should try to find the error?


Additionally, while consulting the manual I found a little error on page 133 it has to be

mypawn.setVec3Attribute("collisionShapeScale", size1, size2, size3)

instead of

mypawn.setVec3Attribute("collisionShape", size1, size2, size3)

December 12, 2015
12:23 am
Forum Posts: 985
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

I've made the fix in the documentation, thanks.

I suspect that the problem is related to retargeting; SmartBody has an online retargeting system where motion data gets transferred in real time to your character. This gives it a lot of flexibility (essentially, any character properly configured can take advantage of any data set) but requires a bit of extra scrutiny. Frankly, it can create some confusion and frustration (even for me...) and I probably should create better tools to visualize this issue.

The reaching data set that you are using is associated with the skeleton. There's an instruction:



which associates a motion with it's original skeleton.

So the first thing I would try is to create your character using that skeleton:

c = scene.createCharacter("mycharacter", "")

sk = scene.createSkeleton("")


and see if that character is able to use your reaching data set, instead of Brad. Brad himself uses a different skeleton configuration (internall, we call this thezebra2 configuration) where joints are named differently. If the character created using the works, but Brad doesn't, then you need to make sure of two things:

(1) that Brad's skeleton has a joint map to the standard skeleton naming. There is a script called that has those instructions (easily converted to C++)

(2) that there is a mapping between and Brad's skeleton that allows the online retargeting to work, like this in


def createRetargetInstance(srcSkelName, tgtSkelName):
endJoints = StringVec();

relativeJoints = StringVec();
# replace retarget each animation with just a simple retarget instance
retargetManager = scene.getRetargetManager()
   retarget = retargetManager.getRetarget(srcSkelName,tgtSkelName)
if retarget == None:
retarget = retargetManager.createRetarget(srcSkelName,tgtSkelName)

where srcSkelName is "" an tgtSkelName is



December 14, 2015
11:27 am
Forum Posts: 24
Member Since:
June 22, 2015
sp_UserOfflineSmall Offline

Thank you four your detailed answer.

These adjustments helped although the main problem originated from the problem that the was not loaded due to a missing line

scene->addAssetPath("motion", "sbm-common/common-sk");

Maybe it would be a helpful thing if there is an error message if one of the skeletons for retargeting is not loaded.

Now it is going in the right direction, still some small problems that I can hopefully solve myself.

Thank you.

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 733

Currently Online:
99 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

jwwalker: 80

jyambao: 53

rbaral: 47

adiaz: 30

WargnierP: 29

lucky7456969: 28

mbarros: 28

avida.matt: 26

JonathanW: 24

laguerre: 23

Member Stats:

Guest Posters: 72

Members: 2025

Moderators: 1

Admins: 3

Forum Stats:

Groups: 1

Forums: 5

Topics: 525

Posts: 2471

Moderators: smbyadmin: 0