# Introduction to Entities

Everything going on in a Blitz3D program takes place within a 3D world, which is populated by 'entities'.

Entities come in many flavors, and each kind of entity performs a certain, specialized task, but all entities have a few things in common, the most important of which are:

All entities have a position, a rotation and a size, and can be moved, rotated and scaled at will.

All entities have an optional 'parent' entity. If an entity has a parent, then it becomes 'attached' to the parent and will move, rotate and scale whenever the parent does.

Now, lets have a quick look at the kind of entities that can be used in the 3D world:

## Cameras

Camera entities allows you to 'see' what's going on in the world. If you don't create at least one camera, you wont be able to see anything! Cameras also control where on the screen 3D rendering occurs, and provide atmospheric fog effects.

## Lights

Light entities provide illumination for the 3D world. Without any lights, you will still see what's happening in the world thanks to 'ambient light'. Amibent light is light that is 'everywhere at once', and illuminates everything equally. However, since ambient light has no position or direction, you wont get nice shading effects, and everything will look very flat.

## Meshes

Mesh entities provide a way to add actual, physical items to the world. Meshes are made up of triangles, and each triangle can be colored or textured in a variety of ways. The most common way of adding a mesh to the world is to load it from a file produced by a 3D modelling program, but you can also create your own meshes.

## Pivots

Pivot entities don't actually do a lot! Their main purpose in life is to provide a parent for other entities. This can be useful for many reasons. For example, by attaching a bunch of meshes to a pivot, you can move all the meshes at once simply by moving the pivot!

## Sprites

Sprite entities are flat, 2D entities most commonly used for particle effects, like explosions, smoke and fire. Sprites automatically face the camera, regardless of the angle you view them from, so are often textured with a 'spherical' style texture.

## Planes

Plane entities are infinitely large, flat surfaces that can be used for a variety of effects such as ground and water. Since planes are entities, they can also be moved and rotated, which means you can also use them for sky and cloud effects.

## Terrains

Terrain entities are used to create very large landscapes. They are constructed of a grid of triangles, and are rendered using a technique that draws an approximation of the terrain using a limited number of triangles. This is necessary for very large terrains that may contains millions of triangles - which would not only be far too slow for realtime rendering, but would also take up way too much memory!

These entities form the backbone of any B3D program, it really is worth spending the time getting to know the various instructions associated with them. As we shall see - by using different parameters and the special additional commands for controlling or altering their behavour, we can adapt an entity to our liking. Even if it means defining a special FX that Blitz, with its present command set cannot do !.

Copyright 2001 (c) Paul Gerfen - GamecodingUK