A Movable Target is a dummy object for movement;
you can set it's mass, velocity,
resistance, and so on; then the program will automatically animate it. For
example, assume we want to create a tiger that walk around in scene; we can
first create a
movtar and set
it's movement parameters, then the movtar will automatically 'walk' in
scene; we just need set the tiger's position same as the movtar.
As movtar will collide with other objects in scene, it need have a specific shape. Awakening provides three shapes for movtar: box, sphere, and point. The point shape is much faster than other two, so use it as possible; especially for small and rapid objects (like bullet). In the script class of movtar, there are three functions for set it's shape: pointed(), setRadius(), setBoundingBox(), below is the usage:
|box is independent of radius|
|sphere is a point that radius>0|
|just set pointed to true is not enough|
A movtar do collide with ocean, terrain, surface, static mesh,
mobile (movtars do not collide
with eachother by default). In collision detection, a surface
treat as a plane, a mesh treat as a box; and ignore all objects with 'no clip'
When collision happen, the program will call movtar's callback function - OnCollide(); You can do something for collision in this function, like make a sound, make a spot, etc.
To create a movtar, use the createMovTar() function of the scene class; please remember use the deleteMovTar() function to delete unused movtars, because movtars is quite a few load on CPU.
-- create a movtar with sphere shape
-- play sound when collision happen
m.OnCollide = function(ptrace)
-- delete the movtar