Difference between revisions of "Adding object to scene"
From XStoryPlayer Wiki
Line 40: | Line 40: | ||
Run the [[filemaker]] and test the scene, you should collide now with the bench. | Run the [[filemaker]] and test the scene, you should collide now with the bench. | ||
</li> | </li> | ||
+ | <li>Now lets make the object dynamic. Change the <code>bench.ini</code> to this: | ||
+ | <syntaxhighlight lang="cpp"> | ||
+ | rb "benchShape" | ||
+ | { | ||
+ | dynamic = true; // Object is dynamic | ||
+ | |||
+ | render {} | ||
+ | |||
+ | physics | ||
+ | { | ||
+ | density = 200; // 200 kg per cubic meter | ||
+ | fc = 0.1; // Low friction | ||
+ | |||
+ | elem[0] {mesh = "coll1Shape";} | ||
+ | } | ||
+ | } | ||
+ | <syntaxhighlight> | ||
+ | Run the filemaker and test the scene, run into the bench and it should move. | ||
+ | </li> | ||
+ | <li>Now lets make a soft body object of the bench.</li> | ||
</ol> | </ol> |
Revision as of 13:22, 16 January 2015
In this tutorial we will explore different ways to add an object to a scene.
Steps
- Copy the bench files from the 'Tutorial resource pack' to the sources directory. It is a simple bench that will be placed in the cell.
- The most simple way to add an object to a scene is to use the reference editor in Maya. Do [File->Create Reference] in Maya and add the
bench.ma
to thescene.ma
. Run the Filemaker and create the scene again. Run the scene, you should see the bench in the scene. - Remove the bench from the scene again using [File->Reference Editor]. Now we will add the object dynamically to the scene.
Add this code to the/init/story/scenes.dat
at the bottom off this file.
dyn_objecti BENCH1 { scene_id = SPACESHIP1; file_name = "scenes/object/benchShape.obj"; }
This will create the bench dynamically in the scene.
- The
bench.ini
file describes the bench object.
rb "benchShape" // A rigidbody object { // Only render the object. // In essence it is now the same as a rd (render) object. render {} }
We want to add a collider to the object. Place a cube named
coll1Shape
around the bench and change the code of thebench.ini
to this:rb "benchShape" { render {} physics { elem[0] {mesh = "coll1Shape";} } }
Run the filemaker and test the scene, you should collide now with the bench.
- Now lets make the object dynamic. Change the
bench.ini
to this:rb "benchShape" { dynamic = true; // Object is dynamic render {} physics { density = 200; // 200 kg per cubic meter fc = 0.1; // Low friction elem[0] {mesh = "coll1Shape";} } } <syntaxhighlight> Run the filemaker and test the scene, run into the bench and it should move. </li> <li>Now lets make a soft body object of the bench.</li> </ol>