Try this code.
This example requires my DKAVM plugin:
http://forum.thegamecreators.com/?m=forum_view&t=67196&b=5
and Cloggy's D3DFunc plugin:
http://forum.thegamecreators.com/?m=forum_view&t=55836&b=5
objectmatrix = 1
lookatvector = 2
lookupvector = 3
righthandvector = 4
null = make matrix4(objectmatrix)
null = make vector3(lookatvector)
null = make vector3(lookupvector)
null = make vector3(righthandvector)
`Initialise the D3Dfunc dll
D3D_Init
make object cube 1, 1
sync rate 0
sync on
do
xangle# = wrapvalue(xangle# + .01)
yangle# = wrapvalue(yangle# + .01)
zangle# = wrapvalue(zangle# + .01)
rotate object 1, xangle#, yangle#, zangle#
dk limb matrix4 objectmatrix, 1, 0
set vector3 lookatvector, 0, 0, 1
transform coords vector3 lookatvector, lookatvector, objectmatrix
set vector3 lookupvector, 0, 1, 0
transform coords vector3 lookupvector, lookupvector, objectmatrix
cross product vector3 righthandvector, lookupvector, lookatvector
D3D_Color 255, 0, 0, 50
D3D_Line3D object position x(1), object position y(1), object position z(1), object position x(1) + x vector3(lookatvector), object position y(1) + y vector3(lookatvector), object position z(1) + z vector3(lookatvector), 0
D3D_Color 255, 255, 0, 50
D3D_Line3D object position x(1), object position y(1), object position z(1), object position x(1) + x vector3(lookupvector), object position y(1) + y vector3(lookupvector), object position z(1) + z vector3(lookupvector), 0
D3D_Color 0, 255, 0, 50
D3D_Line3D object position x(1), object position y(1), object position z(1), object position x(1) + x vector3(righthandvector), object position y(1) + y vector3(righthandvector), object position z(1) + z vector3(righthandvector), 0
sync
loop
Specs: P4 2.4GHz, DIMM 256 266Mhz, 60GB HD 7200rpm ATA-133, GeForce NX6600, CD-RW+DVD, WinXP