Hi all.
I have a function in my program to make a stack of dynamic blocks and set up joints with adjecent blocks. It works the first time I call it but after that the joints don't work. Not even for a seperate function.
Hopefully the code will make more sense.
function makePillar(xdim,ydim,zdim,xpos,ypos,zpos)
posy = ypos
for i = 1 to ydim
posz = zpos
for j = 1 to zdim
posx = xpos
for k = 1 to xdim
make object box ocurrent,2,1,4
phy make rigid body dynamic box ocurrent
phy set rigid body position ocurrent,posx+.1,posy+.1,posz+.1
inc ocurrent
posx = posx + 2
next k
posz = posz + 4
next j
posy = posy + 1
next i
a = ocurrent - (xdim*ydim*zdim)
for y = 1 to ydim
makeJoint1 = 0
if ydim > 1 then if y < ydim then makeJoint1 = 1
for z = 1 to zdim
makeJoint2 = 1
if zdim > 1 then if z = zdim then makeJoint2 = 0
for x = 1 to xdim
makeJoint3 = 1
if xdim > 1 then if x = xdim then makeJoint3 = 0
if makeJoint3 = 1 then if xdim > 1 then phy make fixed joint pcurrent,a, a+1 : phy build fixed joint pcurrent : inc pcurrent : rd = 100
if makeJoint2 = 1 then if zdim > 1 then phy make fixed joint pcurrent,a,(a+xdim) : phy build fixed joint pcurrent : inc pcurrent : grn = 100
if makeJoint1 = 1 then if ydim > 1 then phy make fixed joint pcurrent,a,(a+(zdim*xdim)) : phy build fixed joint pcurrent : inc pcurrent : blu = 100
color object a,rgb(rd,grn,blu)
inc a
next x
next z
next y
endfunction
xdim is an amount of blocks along the x axis
ydim and zdim are similar
xpos, ypos and zpos are positions