I've integrated Ruccus' code into mine so that it works with it. It's working, but not precisely to my requirements. I have tinkered with the values, but I don't understand or know how to make it work the way I want it to. If you run the code first, I'll describe the problem. The only working function is the left key so far.
Rem Project: AH Computing Project
Rem Created: 23/11/2005 16:13:37
Rem ***** Main Source File *****
` FOR LOOPs to create 27 aligned cubes spaced 100 units from each other in a 3 x 3 x 3
` formation. (Prototype for 3D Noughts and Crosses). x co - ord used to alter position.
` Linea1 is cube 1 to 3, i.e the first 3 cubes at the bottom of a 3 by 3 by 3 cube closest
` to the camera. Line a2 is the next 3 cubes behind Linea1. Lineb1 is 100 Y co-ordinates
` above Linea1. No concise as of yet for clarity.
x = 0
for linea1 = 1 to 3
make object cube linea1,50
position object linea1, x, 0, 0
x = x + 100
next linea1
x = 0
for linea2 = 4 to 6
make object cube linea2,50
position object linea2, x, 0, 100
x = x + 100
next linea2
x = 0
for linea3 = 7 to 9
make object cube linea3,50
position object linea3, x, 0, 200
x = x + 100
next linea3
x = 0
for lineb1 = 10 to 12
make object cube lineb1,50
position object lineb1, x, 100, 0
x = x + 100
next lineb1
x = 0
for lineb2 = 13 to 15
make object cube lineb2,50
position object lineb2, x, 100, 100
x = x + 100
next lineb2
x = 0
for lineb3 = 16 to 18
make object cube lineb3,50
position object lineb3, x, 100, 200
x = x + 100
next lineb3
x = 0
for linec1 = 19 to 21
make object cube linec1,50
position object linec1, x, 200, 0
x = x + 100
next linec1
x = 0
for linec2 = 22 to 24
make object cube linec2,50
position object linec2, x, 200, 100
x = x + 100
next linec2
x = 0
for linec3 = 25 to 27
make object cube linec3,50
position object linec3, x, 200, 200
x = x + 100
next linec3
` End of cube creation.
`Position camera away from cubes and deviated slightly by 70 (x Co-ord) to see all cubes).
position camera 100,100,-400
`position camera 100, 100, -400 (Final camera positioning once rotation complete.)
`Point the camera at the central cube (object 14), co-ord 100,100,100
point camera 100,100,100
MAKE OBJECT cube 28,1
MAKE MESH FROM OBJECT 1,28
ADD LIMB 28,1,1
OFFSET LIMB 28,1,100,100,-400
DELETE MESH 1
`Sync setup
sync on
sync rate 30
`Main loop
do
if leftkey () = 1 then
YROTATE OBJECT 28,WRAPVALUE(OBJECT ANGLE Y(28)+5)
position camera LIMB POSITION X(28,1),LIMB POSITION Y(28,1), LIMB POSITION Z(28,1)
point camera 100,100,100
if rightkey () = 1 then `rotate around the central cube going anti-clockwise, y rotation.
if upkey () = 1 then `rotate around the central cube, x rotation upwards.
if downkey () = 1 then `rotate around the central cube, x rotation downwards.
sync
loop
`End of program
It rotates around the central cube, but changes distance as it circles around the rear of the cube formation. I would fix this myself, but I haven't a clue what limbs are, how it works here, etc. In fact, I don't even have a scooby how Ruccus' code works but it works.