Q1. Mesh
( MESH_ID
)の ID がわかっている場合は、次のようになります。
try {
Object3D[] roots = Loader.load( "http://www.example.com/scene.m3g" );
World world = roots[0];
Mesh mesh = world.find( MESH_ID );
}
catch( Exception e ) {
// Handle it
}
Q2. 基本をロードしWorld
ます。
public class MyCanvas extends Canvas
Graphics3D g3d;
World world;
int currentTime = 0;
public MyCanvas() {
g3d = Graphics3D.create();
Object root[] = Loader.load("world.m3g");
world = root[0];
}
protected void paint(Graphics g) {
g3d.bindTarget(g);
world.animate(currentTime);
currentTime += 50;
g3d.render(world);
g3d.releaseTarget();
}
}
次に、API を使用してオブジェクトを作成し、世界に追加します。API ドキュメントでは、これについて詳しく説明しています。
Q3. それらを Blender に割り当ててから、find
メソッドを使用して必要なインスタンスを正確に取得しObject3D
ます。
Q4. メッシュを (異なるアプリケーションで) 再利用する予定がある場合は、メッシュを個別のファイルに整理し、アプリケーションの初期化中に個別にロードしてから、ワールドに挿入します。