Might be useful to someone, this is equivalent of DBPro commands float=Collision Center X/Y/Z. You can remove the first few lines that reference INFINITY limit. Code makes use of vector3 math commands.
[edit] - I forgot to tidy up. vectors/object/mesh now get deleted from memory.
Rem ***** Main Source File *****
sync on : sync rate 30 : sync
global INFINITY as float = 3.4E38
global EPSILON as float = 0.001
print "Infinity: ";INFINITY;", Epsilon: ";EPSILON
minPt=reserve free vector()
maxPt=reserve free vector()
center=reserve free vector()
rmin=make vector3(minPt)
rmax=make vector3(maxPt)
rcen=make vector3(center)
set vector3 minPt,INFINITY,INFINITY,INFINITY
set vector3 maxPt,-INFINITY,-INFINITY,-INFINITY
set vector3 center,0,0,0
add vector3 center,minPt,maxPt
print "minPt x,y,z: ";x vector3(minPt); ", ";y vector3(minPt); ", ";z vector3(minPt)
print "maxPt x,y,z: ";x vector3(maxPt); ", ";y vector3(maxPt); ", ";z vector3(maxPt)
print "center x,y,z: ";x vector3(center); ", ";y vector3(center); ", ";z vector3(center)
multiply vector3 center,0.5
print "mult center x,y,z: ";x vector3(center); ", ";y vector3(center); ", ";z vector3(center)
load object "door_g_quat_x.dbo",1
`make object box 1,10,10,10
make mesh from object 1,1
x as float : y as float : z as float
minx as float : miny as float : minz as float
maxx as float : maxy as float : maxz as float
lock vertexdata for mesh 1
vc=get vertexdata vertex count()
ic=get vertexdata index count()
for v=0 to vc
x = get vertexdata position x (v)
y = get vertexdata position y (v)
z = get vertexdata position z (v)
if x < minx then minx=x
if y < miny then miny=y
if z < minz then minz=z
if x > maxx then maxx=x
if y > maxy then maxy=y
if z > maxz then maxz=z
next v
unlock vertexdata
print "minx: ";minx; " maxx: ";maxx
print "miny: ";miny; " maxy: ";maxy
print "minz: ";minz; " maxz: ";maxz
delete mesh 1
set vector3 minPt,minx,miny,minz
set vector3 maxPt,maxx,maxy,maxz
set vector3 center,0,0,0
add vector3 center,minPt,maxPt
print "minPt x,y,z: ";x vector3(minPt); ", ";y vector3(minPt); ", ";z vector3(minPt)
print "maxPt x,y,z: ";x vector3(maxPt); ", ";y vector3(maxPt); ", ";z vector3(maxPt)
print "center x,y,z: ";x vector3(center); ", ";y vector3(center); ", ";z vector3(center)
multiply vector3 center,0.5
print "mult center x,y,z: ";x vector3(center); ", ";y vector3(center); ", ";z vector3(center)
sync
wait key
`tidy up
delete vector3(minPt)
delete vector3(maxPt)
delete vector3(center)
release reserved vector minPt
release reserved vector maxPt
release reserved vector center
delete object 1
end
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others