3d Animation
From Emergent
You can use the Virtual Environment system in the 3D view to create an animation of your model's behavior, even in situations where it is not a fully "embodied" model.
For example, if you are simulating a rat running in a maze, you can actually construct the maze and show the rat running around in it.
Steps for Creating the Virtual Environment
- Create a VEWorld object in .objs of a Program
- do NewView on that object to create a 3d view of the world
- Create a VEObject in objects and a VEBody in that object
- you can use obj_fname in the body object to load in an Open Inventor format 3d object file -- the 3dobj_lib (usually /usr/local/share/Emergent/3dobj_lib) directory has some sample files (rat.iv and banana.iv)
- need to press Set Vals To ODE on VEWorld object to see changes to shape/geometry of the object (location, orientation, and color are automatically updated).
- enter a position and rotation (or drag in the view using red arrow)
- Create a VESpace in spaces and VEStatic objects there to represent the static elements of the environment, such as a ground plane, walls, etc.
- Textures are shared, so you create a texture, associate it with an image file (3dobj_lib has examples), and then select that texture obj on the body or static guy.
How to Program Animations
- the SetValsToODE function on the VEWorld will re-initialize all the positions of the bodies according to init_pos, etc. So, you can call that in the .init_code section of your program to start everything over.
- To make things move, simply update their cur_pos.x,y,z values (or any other cur_xxx settings)! For the last coordinate that you update on a given body object, using the MemberAssign program element, be sure to click the update_after button, which will call the UpdateAfterEdit() function on that object, which is what actually updates the display!
- Use a for loop to make smaller steps in the cur_pos values so the animation is smooth.
TODO: see the demo/leabra/icond.proj for a demo of such an animation, in the VEAction program in the Environment program subgroup.
