CodeRecipe( );

one stop for all game coders..

Follow us on Twitter
Home >> Tutorials >> Game 3D-Engine >> Save 3D world
Coderecipe Tutorials

Save 3D world Print E-mail
User Rating: / 1
PoorBest 
Written by CR Team   
Tuesday, 18 August 2009 16:28

Saving a 3d world in Adobe Director 11.x is quite simple.

Tere are 2 ways of doing the same, using the 2 methods: SaveW3d() and saveWorld().3d

SaveW3d: ( can be used only in a projector or Adobe Director authoring )

The behavior of this method is as follows:

  • If the absolute path is provided, this method saves the 3D scene ( current instance ) with he filename provided in the path (provided the path is correct). This will happen in both Authoring and Projector mode.
  • If the absolute path is not provided that is, the call is membername.savew3d(), the behavior is as follows:
  1. If the w3d member is externally linked and savew3d is called in projector mode, then the 3D scene at that instant is saved to the externally linked w3d file overwriting the file.
  2. If the w3d member is internal and savew3d is called in projector mode, then this method call is ignored.
1
2
3
-- Lingo syntax 
--3dworld - the name of your 3d world cast member
member("3dworld").savew3d(the moviepath & "savedworld.w3d")
1
2
//JavaScript syntax 
member("3dworld").savew3d(the moviepath & "savedworld.w3d");

saveWorld: Saves the existing 3D world to the 3D member after you save the movie.

Use of this method will allow you to save a state in your 3d world, Ideal for internal cast member where you want to remove the redundancy of cloning models shaders, creation of primitive models etc. Once your 3d scene is loaded as required, you can call it to save that required state.

1
2
-- Lingo syntax 
member("3dworld").saveWorld()
1
2
// JavaScript syntax 
member("3dworld").saveWorld();

saveWorld() only preserves the existing 3d world state only when the Director movie is saved.

Note: The above 2 methods can also be used to save the proxy templates created in the physics world.