Quote: "I don't know which function calls need the actual object numbers and which ones I can use my index number."
All of the funcs need your index number, none of the DLL calls need the object number.
Try a code more like:
rem Gets a free index
function GetFreeIndex()
for index = 5000 to 1 step -1
if indexArray(index)=0
exitfunction index
endif
objNum = indexArray(index)
if not object exist(objNum)
exitfunction index
endif
next index
endfunction
rem Sets the collision type for this object
function CollisionTypePRO( object, collID )
rem if object does not exist then exit with an error
if not object exist(object)
if NGC_debug
exit prompt "CollisionTypePRO object does not exist: "+str$(object)+" Type Setting: "+str$(collID),"Collision DLL"
end
endif
endif
rem Fetch a free index num
index = GetFreeIndex()
rem store object number in array position
indexArray(index) = object
ok = call dll( NGC_dll, "NewCollObjPRO", index, collID )
rem if collID is positive, then add collision shapes for this object
if collID > 0
rem Checks/Adds ellipsoid shape to object
retval = call dll( NGC_dll, "CheckShapePRO", index, 1 )
if retval
ok = call dll( NGC_dll, "AddObjShapePRO", index, 1 )
endif
retval = call dll( NGC_dll, "CheckShapePRO", index, 2 )
if retval
rem Get object position
xpos# = object position x(object)
ypos# = object position y(object)
zpos# = object position z(object)
rem Get object rotation
xrot# = object angle x(object)
yrot# = object angle y(object)
zrot# = object angle z(object)
rem Places object at 0,0,0 so vert data is local
position object object, 0, 0, 0
rotate object object, 0, 0, 0
rem Resets the object scale so it's local
rem (important for dynamic scale later!)
scale object object, 100, 100, 100
rem Places the mesh into collision memory
ok = call dll( NGC_dll, "AddObjShapePRO", index, 2 )
mesh = 99 : make mesh from object mesh,object
memb = 99 : make memblock from mesh memb, mesh
MeshPtr = Get Memblock Ptr(memb)
ok = call dll( NGC_dll, "AddMeshPRO", index, MeshPtr )
delete memblock memb
delete mesh mesh
rem Put object back to avoid angry developers
position object object, xpos#, ypos#, zpos#
rotate object object, xrot#, yrot#, zrot#
endif
rem endif collID is positive
endif
rem Activates the object
ActivateObjPRO( index )
rem Sets the scale for the object
SetObjScalePRO( index, 100, 100, 100 )
rem Updates the object
ResetObjPRO(index)
rem send the new index number back
endfunction index
rem Then other functions would rely on your index number (you could use a passed in object number but you'd have to scan the whole array to find the index)
function SetObjGravityPRO( index, gravity# )
ok = call dll( NGC_dll, "SetObjGravityPRO", index, gravity# )
endfunction
function RunCollisionPRO()
ok = call dll( NGC_dll, "ResetCollisionStackPRO" )
index = call dll( NGC_dll, "PeekCollisionStackPRO" )
object = indexArray(index)
while object > 0
if not object exist(object)
ok = call dll( NGC_dll, "FreeObjPRO", index )
else
xpos# = Object Position X(object) : ypos# = Object Position Y(object) : zpos# = Object Position Z(object)
xrot# = Object Angle X(object) : yrot# = Object Angle Y(object) : zrot# = Object Angle Z(object)
ok = call dll( NGC_dll, "SetObjPosPRO", xpos#, ypos#, zpos# )
ok = call dll( NGC_dll, "SetObjRotPRO", xrot#, yrot#, zrot# )
ok = call dll( NGC_dll, "UpdateObjPRO", index, 0 )
endif
index = call dll( NGC_dll, "PeekCollisionStackPRO" )
object = indexArray(index)
endwhile
ok = call dll( NGC_dll, "RunCollisionPRO" )
ok = call dll( NGC_dll, "ResetCollisionStackPRO" )
index = call dll( NGC_dll, "PeekCollisionStackPRO" )
object = indexArray(index)
while object > 0
objx# = call dll(NGC_dll, "PeekObjXPRO", index )
objy# = call dll(NGC_dll, "PeekObjYPRO", index )
objz# = call dll(NGC_dll, "PeekObjZPRO", index )
rotx# = call dll(NGC_dll, "PeekObjPitch", index )
roty# = call dll(NGC_dll, "PeekObjYaw", index )
rotz# = call dll(NGC_dll, "PeekObjRoll", index )
position object object, objx#, objy#, objz#
rotate object object, rotx#, roty#, rotz#
index = call dll( NGC_dll, "PeekCollisionStackPRO" )
object = indexArray(index)
endwhile
endfunction
Then to call it you go like:
rem Probably keep this index as a field in a type field in your object list
objIndex = CollisionTypePRO( myObj, TYPE_WORLD )
rem Set gravity for the object using the index
SetObjGravityPRO(objIndex, 5.0)
rem Run Collision
RunCollisionPRO()
Hope that helps. Essentially you're creating an alias (the index number) for an object that the collision system will recognize the object by. The index number ranges from 1 to 5000 and the object number can be anything.
(I haven't tested the above code, but it looks right)
Quote: "Anyway, as usual you've got more good news, but can we get a hint of what might be coming up after NN is up and running. "
For public news it's NN and NGC (as you already know). We've got a 3rd classified project moving and I'm not at liberty to talk about it atm
NN just needs documentation and a launch. I didn't want it to interfere with the other 2 parts here, so that's why it was delayed. I didn't want to get caught up taking care of a launch when I could be putting these other products/tools together.
Woo, alright then. I have work to do