CRE8OR - game maker for anim8or

 


BILLBOARDS/SPRITES


You'll need Cre8or Version 0.12b in order to run this correctly.

Cre8or v0.12b has a new feature that allows you to have 2D pictures in the games. However you have to use scripts to add billboards.

To add a sprite/billboard first we need to create a set of billboards:

The following code is in a code piece in the Scene Create Event:

To add a billboard set you create a new class:

ten <- billboards()

Now we need to initiate it.

ten.create(10, "10points.png", 15.0, 15.0)

The first parameter "10" is the number of billboards you plan on creating. The Next one is the texture file name you want to load it. You can add a texture to the game and use the file name for that. The next to numbers "15.0" is the height and width of the image in 3D. Make sure you width and height values have the decimal place.

Now we should set the type of billboards to use:

ten.set_type(BBT_POINT)

usre respectively:

BBT_POINT
BBT_ORIENTED_SELF
BBT_ORIENTED_COMMON
BBT_PERPENDICULAR_COMMON
BBT_PERPENDICULAR_SELF

Here's a discription of the different types:

point - The default arrangement, this approximates spherical particles and the billboards always fully face the camera.

oriented_common - Particles are oriented around a common, typically fixed direction vector, which acts as their local Y axis. The billboard rotates only around this axis, giving the particle some sense of direction. Good for rainstorms, starfields etc where the particles will travelling in one direction - this is slightly faster than oriented_self.

oriented_self - Particles are oriented around their own direction vector, which acts as their local Y axis. As the particle changes direction, so the billboard reorients itself to face this way. Good for laser fire, fireworks and other 'streaky' particles that should look like they are travelling in their own direction.

perpendicular_common - Particles are perpendicular to a common, typically fixed direction vector, which acts as their local Z axis, and their local Y axis coplanar with common direction and the common up vector. The billboard never rotates to face the camera, you might use double-side material to ensure particles never culled by back-facing. Good for aureolas, rings etc where the particles will perpendicular to the ground - this is slightly faster than perpendicular_self.

perpendicular_self - Particles are perpendicular to their own direction vector, which acts as their local Z axis, and their local Y axis coplanar with their own direction vector and the common up vector. The billboard never rotates to face the camera, you might use double-side material to ensure particles never culled by back-facing. Good for rings stack etc where the particles will perpendicular to their travelling direction.

To set a direction if you use the "Common" types then use this:

ten.set_dir( vector(x, y, z) )

Make sure the values have the decimal place. To add a billboard use the following code:

ten.add(vector(15.0, 0.0, 15.0), color(1.0, 1.0, 1.0))

The first parameter: vector(15.0, 0.0, 15.0) is the position. The second one is the color: color(1.0, 1.0, 1.0)

To control the position of a single billboard use this:

bb1 <- ten.add(vector(15.0, 0.0, 15.0), color(1.0, 1.0, 1.0))

bb1.set_position( vector(15.0, 0.0, 15.0) )

bb1.set_orientation( quaternion )

bb1.set_color( color(1.0, 1.0, 1.0) )

bb1.set_dimensions( width, height)

To remove it do this:

bb1.remove()

To remove all the billboards do this:

ten.clear()


Tutorials Page




Copyrights (C) 2007 Keith Tabert
Thanks to R. Steven Glanville for Anim8or, Robin