As above but done as a function.
rem Mesh Manipulation
rem Compiles under: U6.0
rem from help files
rem path C:\Program Files\Dark Basic Software\Dark Basic Professional\Help\examples\basic3d\basic3d3-example.dba"
rem Standard Setup Code for all examples
sync on : sync rate 0 : color backdrop rgb(0,128,0)
set text font "arial" : set text size 16
set text to bold : set text transparent
ink rgb(255,255,0),0
rem models from help file
rem Load model
ObjectNumber=1
set dir "models"
load object "ninja.x",ObjectNumber
rotate object ObjectNumber,0,0,0
scale object ObjectNumber,6000,6000,6000
set dir ".."
rem Make a new object from an object
MeshIndex=1
ObjectNumberC=3
ImageNumber=1
load image "models\ninja.bmp",ImageNumber
make mesh from object MeshIndex,ObjectNumber
make object ObjectNumberC, MeshIndex, ImageNumber
position object ObjectNumberC, 100, 0, 0
set object light ObjectNumberC,1
delete mesh MeshIndex
rem Example prompt
desc$="Normal Object and Object From Mesh"
rem Setup camera
position camera 0,100,-300
autocam off
rem Main loop
do
rem Show all limbs
set cursor 0,0
print "LIMBS IN OBJECT"
perform checklist for object limbs ObjectNumber
for c=1 to checklist quantity()
print " ";checklist value a(c);" ";checklist string$(c)
next c
center text screen width()/2 , 0, "Press C to change limb 11"
rem Rotate objects
yrotate object ObjectNumberC,wrapvalue(object angle y(ObjectNumberC)+1)
yrotate object ObjectNumber,wrapvalue(object angle y(ObjectNumber)-1)
rem Show Framerate
text 20,screen height()-40,desc$
fps$="DBPro Fps: "+str$(screen fps())
text screen width()-20-text width(fps$),screen height()-40,fps$
rem change Limb 11
if inkey$()="c"
rem changeLimb(object, limb, X_angle, Y_angle, Z_angle, X_offset, Y_offset, Z_offset, X_scale, Y_scale, Z_scale, filename$)
changeLimb(1, 11, 90.0, 0.0, 90.0, 0, 0, 0, 5.0, 5.0, 5.0, "models\new gun.x")
endif
rem Update screen
sync
rem End loop
loop
remstart
mainobjectNumber as integer
LimbNumber as integer
NewAngle_X as float
NewAngle_Y as float
NewAngel_z as float
NewOffset_x as float
NewOffset_y as float
NewOffset_z as float
NewScale_x as float
NewScale_y as float
NewScale_z as float
NewObjectFile$ as string
remend
function changelimb(MainObjectNumber as integer, LimbNumber as integer, NewAngle_X as float,NewAngle_Y as float, NewAngel_z as float,NewOffset_x as float, NewOffset_y as float, NewOffset_z as float,NewScale_x as float, NewScale_y as float, NewScale_z as float, NewObjectFile$ as string)
NewObjectNumber = 50000
NewMeshIndex = 50000
if limb exist(MainObjectNumber,LimbNumber)=1
rem load new object
load object NewObjectFile$,NewObjectNumber
rem scale new object to the current object
scale object NewObjectNumber,NewScale_x,NewScale_y,NewScale_z
rem make a mesh of new object
make mesh from object NewMeshIndex,NewObjectNumber
rem delete the loaded object
delete object NewobjectNumber
rem swap the meshes over
change mesh MainObjectNumber,LimbNumber,NewMeshIndex
rem offset the limb or rotate the limb
rotate limb MainObjectNumber,LimbNumber,XAngle, YAngle, ZAngle
rem delete the mesh
delete mesh NewMeshIndex
endif
endfunction
Dark Physics makes any hot drink go cold.