Right an explanation of limbs...
Limbs are basically objects that take on the rotation, location and movement of an object of your choice. You can manipulate limbs a lot of ways, offsetting them for example, or maybe hiding them if they aren't meant to be seen.
Open up DBP and enter the following as our base code structure (I'm assuming you know a fair amount of DBP and can understand this basic layout):
SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE
MAKE OBJECT SPHERE 1,10
POSITION CAMERA 0,200,-300
POINT CAMERA 0,0,0
DO
IF UPKEY()=1 THEN MOVE OBJECT 1,1
IF DOWNKEY()=1 THEN MOVE OBJECT 1,1
IF RIGHTKEY()=1 THEN TURN OBJECT RIGHT 1,.5
IF LEFTKEY()=1 THEN TURN OBJECT LEFT 1,.5
SYNC
LOOP
Now that we have a basic setup we can continue on with the limbs part.
Creating a limb requires 3 things, the object you want the limb to be attatched to, the mesh you want the limb to be created from, and the limb number the limb will be identified with.
To start we'll make a box object, enter this after the MAKE OBJECT SPHERE line:
MAKE OBJECT BOX 2,30,50,30
Now we will make a mesh from the box. Meshes are basically the main data of the structure of the 3D object. To create a mesh we require the mesh number we want to identify it with, and the object number we want to make the mesh from. Add this code after the line we previously typed:
MAKE MESH FROM OBJECT 1,2
We've created a mesh numbered 1, from our box object 2.
Now we'll delete the object 2 since it isn't needed anymore:
Now its time to add the limb. Add this code:
We've added the limb to object number 1, made from mesh number 1, with a limb number 1. It's important to note that limbs must be linked in chain sequence, by this I mean that the first limb to be attatched to the parent object must be numbered 1, the next one must be 2, and so on.
Also, note that when you get into complex objects made in modelers they often have many limbs already. This can be a problem since limbs must be added in chain sequence, so basically we need to get the amount of limbs the object has so we know what to number the next limb. If this were the case, you would first use this command:
PERFORM CHECKLIST FOR OBJECT LIMBS Object
Replacing Object with the object in question. Then you would use the CHECKLIST QUANTITY command to store the amount of limbs in a variable, like so:
Limb=CHECKLIST QUANTITY+1
Now you just use the new variable we have as the limb number.
Coninuing on, we've used the mesh so now we can delete it, add this code:
Next we'll offset the limb to the right of the user, add this:
This command requires the parent object number holding the limb ; 1, the limb number; 1, and the x y and z offset. In this case we've offset it 45 units to the right, 0 up and 0 behind.
There you have it, run the program and you should have a sphere that you can move with the arrow keys, and a box-like limb that stays to the right of it.
Here's the final source:
SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE
MAKE OBJECT SPHERE 1,10
MAKE OBJECT BOX 2,30,50,30
MAKE MESH FROM OBJECT 1,2
DELETE OBJECT 2
ADD LIMB 1,1,1
DELETE MESH 1
OFFSET LIMB 1,1,45,0,0
POSITION CAMERA 0,200,-300
POINT CAMERA 0,0,0
DO
IF UPKEY()=1 THEN MOVE OBJECT 1,1
IF DOWNKEY()=1 THEN MOVE OBJECT 1,1
IF RIGHTKEY()=1 THEN TURN OBJECT RIGHT 1,.5
IF LEFTKEY()=1 THEN TURN OBJECT LEFT 1,.5
SYNC
LOOP
Just some uses for limbs:
Offset an invisible limb behind the user, position the camera there and point it toward the user and you have 3rd person view.
Offset it at a given point and check for intersections, useful for basic polygonal collision detection.
Many more im too tired to list right now
Hope it helps.