University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

Setting an scenario in SmartBody | 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
Setting an scenario in SmartBody
June 24, 2015
3:48 pm
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Hello

Currently, I am developing a simulator using Smartbody and I would need to recreate a floor of a building. Which method would be the best to add this scenario to SmartBody? I have the map of the building in 2D and 3D files; and I can get the vectorial description.

Thank You

June 24, 2015
5:47 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

If the model is in a standard format (obj, ply, dae), then you can load it as an asset into SmartBody, either by dragging to the outliner window on the left, or running the Python command:  

scene.loadAssetsFromPath("/path/to/my/model.obj")

Then you can create a pawn, and associate that model with a pawn:

mypawn = scene.createPawn("mypawn")

mypawn.setDoubleAttribute("meshScale", 1.0) # scale the model accordingly

mypawn.setStringAttribute("mesh", "model.obj")

Does this work for you?

 

Ari

July 3, 2015
3:09 pm
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Hello, Ari.

Thanks for your advice, but I could not set the scenario. I used both .obj and .dae files, but I got an error. It says that no deformable mesh could be found. Do you know what can be the solution?

Thanks

July 3, 2015
5:18 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Can you send me the obj file so that I can test it out and see what the problem is?

 

Ari

shapiro@ict.usc.edu

July 8, 2015
7:39 am
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Since it was caused by an error in the SDK version I was using, which would be the best solution? Would be the revision available to download in the download section of the web or should I download it using subversion? When I try the second way, I get a too big repository. I only need the SDK but no the one I am using now. I am using Smartbody in Ubuntu 14.04.

Thank you.

July 9, 2015
4:06 am
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

If you don't get the code from the repository (and make sure that you only download the trunk/ and not the entire repository, should only be a few GB), you'll have to wait for me to release a nee linux SDK, which is mostly a matter of making sure that the Makefiles are in order and that the code builds properly on Ubuntu. Hopefully I can get to this in the next day or two. 

 

Ari

September 21, 2015
6:19 pm
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Hello, Ari

Could you please update the linux sdk version? I think the one available for download in the web is the one that gave errors setting the scenario.

Thanks

September 22, 2015
6:15 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Ok, let me see if I can get a version out quickly.

In case you can't wait, I build the linux SDK from a script in the repository here:

trunk/sdk/linux/createLinuxSDK.sh

 

Ari

September 22, 2015
9:37 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Ok, I posted a new version of the linux SDK (r6201) here:

http://sourceforge.net/project.....z/download

 

Ari

September 30, 2015
1:13 am
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Thank you Ari. I can set the scenario. However, the mesh is huge. I try to set the mesh scale with the command you say above, nontheless, smartbody says that the pawn does not have a double attribute named meshScale. How could I fix this?

Thank you in advance

September 30, 2015
7:14 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

I changed the scale to use a SrVec (vector) instead of a single value.

Try:

pawn.setVec3Attribute("meshScale", .01, .01, .01)

Ari

October 1, 2015
7:04 pm
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Hi, Ari

I have used the command, but the mesh scale does not change. After creating the pawn with

scene.loadAssetsFromPath("scene/ETSIT.obj")
mypawn = scene.createPawn("mypawn")
mypawn.setVec3Attribute("meshScale", 0.01, 0.01, 0.01)
mypawn.setStringAttribute("mesh", "ETSIT.obj")

I get

https://www.dropbox.com/s/oi4k27sbw6hshpz/Captura%20de%20pantalla%20de%202015-10-01%2019%3A01%3A16.png?dl=0

which the same mesh I got before. Am I doing something wrong?

October 1, 2015
8:14 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Looks like I made that fix in revision 6145, but the current SDK is only revision 6140. If you are building SmartBody from source, you can update your source code. If you have the SDK, you can make this change by making sure that file:

 

sbgui\src\SBOgreListener.cpp from line 127:

 

SrVec meshScale = pawn->getVec3Attribute("meshScale");
SceneNode * mSceneNode = ogreInterface->getSceneManager()->getRootSceneNode()->createChildSceneNode(name);
mSceneNode->attachObject(ent);
mSceneNode->setVisible(ogreInterface->getCharacterVisiblility());
mSceneNode->setScale(meshScale[0], meshScale[1], meshScale[2]);

October 9, 2015
2:19 am
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Hello, Ari

I have tried it, but my Smartbody file has those lines already. However, I can't change the scale of the mesh.

Thanks

November 18, 2015
11:59 pm
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

As I said, that lines are present in my file, but I still can't change the scale of meshes... I would appreciate if I could have an updated ubuntu sdk, if this bug has been fixed in the current version.

Thank you

November 30, 2015
7:52 pm
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Hello

Finally, I could add the scenario to smartbody using the new sdk, thanks! However, the walls of this scenario are not solid. How could I make them solid?

Thank you

November 30, 2015
9:54 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

What do you mean by 'not solid'? Is there any transparency in the model that you are using?

December 1, 2015
8:43 am
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Hello, Ari

The character in the example AddCharacter can go through walls of my model. Maybe is because the character has no collision shape or something, I don't know. I would like to correct this, how could I?

Thank you

December 1, 2015
2:32 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

The steering algorithm needs boxes to define the valid locomotion space; it doesn't see your mesh.   You can create additional pawns and assign collision surfaces  to those pawns such that it covers the same area as does your mesh (i don't have an automatic way to do this yet). Once you have laid out those collision area, the steering will make sure that the character avoids those walls.

Now this doesn't mean that the character won't penetrate those walls, only that it will steer  to avoid them.  If you want the character to be constrained by your mesh,  you can enable the collision manager and enforce a penetration constraint on contact (described in the manual).

Ari

January 14, 2016
12:27 am
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

I suppose that I could tell the steering manager to avoid a certain number of points. Could you tell me how shall I do it, please? 

Thank you

January 14, 2016
7:49 am
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

You can create a pawn in the area that you want to avoid, then give the pawn a collision shape:

 

mypawn.setStringAttribute("collisionShape", "box")

mypawn.setVec3Attribute("collisionShapeScale", 2,2,2)

 

then enable the steering

 

scene.getSteerManager().setBoolAttribute("enable", False)

scene.getSteerManager().setBoolAttribute("enable", True)

 

You should be able to visualize this in sbgui (View-> Steer -> All Steering). 

Ari

January 14, 2016
12:05 pm
Avatar
Member
Members
Forum Posts: 11
Member Since:
July 29, 2015
sp_UserOfflineSmall Offline

You could also use a generated Navigation Mesh for your building, you can find instructions for it under "Configuring Locomotion, Steering and Path Finding" in the documentation. It's sometimes hard to set it up right depending on the scale of your scene etc., I did make a thread about such a problem, where Ari helped me, so if you had similar problems you could check it out.

Although if you only have a few objects on the floor I'd do as Ari pointed out in the previous post and place a few pawns.

Forum Timezone: America/Los_Angeles

Top Posters:

jwwalker: 80

jyambao: 52

rbaral: 47

adiaz: 30

WargnierP: 29

lucky7456969: 28

mbarros: 28

avida.matt: 26

JonathanW: 24

laguerre: 23

Member Stats:

Guest Posters: 69

Members: 122101

Moderators: 3

Admins: 4

Forum Stats:

Groups: 1

Forums: 5

Topics: 531

Posts: 2495