University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

Update control | 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
Update control
September 21, 2015
6:17 pm
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Hello

I am currently using Smatbody to simulate a evacuation plan. I create some characters and they follow an array of positions, updating the position with every update. The problem is that the simulation runs very slowly. Is there any possibility to control the frequency with the update script is executed?

Thanks

September 21, 2015
9:57 pm
Avatar
Admin
Forum Posts: 52
Member Since:
August 8, 2012
sp_UserOfflineSmall Offline

Hi Adiaz,

You can use the following script to adjust the update frequency of the steering engine by setting freq below to your desired value (by default it's 60 per second):

steerManager = scene.getSteerManager()

steerManager.setDoubleAttribute('maxUpdateFrequency', freq) 

steerManager.stop()

steerManager.start()

Let me know if this helps.

Andrew

September 21, 2015
10:01 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Do you mean that in the script you are setting the position of the characters like this:

 

character.setPosition(SrVec(10, 0, 2))

or are you sending locomotion commands to go to different locations:

 

bml.execBML('mycharacter', '<locomotion target="10 20"/>')

 

How many characters are you using? The current code on a decent computer can likely support about 50 characters at once. Can you post a snippet of your update script?

 

Ari

September 23, 2015
2:00 am
Avatar
Member
Members
Forum Posts: 30
Member Since:
April 27, 2015
sp_UserOfflineSmall Offline

Thanks, Ari. However, it was not necessary, my script had some problems, actually, but they are fixed 🙂

However, I've find that changing the scene scale I have some problems executing bml commands and moving the characters. I can run the simulation perfectly with a scale of 1.0, but with 0.1 or 0.01, the characters won't move with the bml commands. Why could this happen?

September 25, 2015
5:36 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

A scene scale of 1.0 means that units are in meters, while a scene scale of .01 means that the units are in centimeters. Assuming you are simulating human-like things, you want to make sure that the scene scale is set according to the size of the characters. The default characters in the SmartBody distribution are measured in meters (around 2 meters tall).

 

The steering parameters are in meter scale, and there are a number of parameters that control locomotion (such as the default radius of the agent used for collision, the distance to the target within which the target will be considered to be reached, the distance to the target within which stepping instead of normal walking will be used, etc) that do not work well when scaled improperly. 

So as long as your characters are truly in meters scale, stick with a scene scale of 1.0, since not doing so will cause the algorithms not to function properly.

 

This makes me think that I should add some visualizations that represent those steering parameters to make this debugging a bit easier.

Ari