In case you should ever need such a thing, these functions will let you offset, scale, or rotate an object within its vertexdata. This will, for example, allow you to clone the object and have it keep all these settings.
I'm using it in an editor program where I want to be able to adjust an object and then save it, having it retain the adjustments.
I should note that unlike the DBP command, the vert functions act cumulatively, so if you tell it to rotate the object 40 degrees and then tell it to do 50 degrees, overall the object will be rotated 90 degrees, whereas with ROTATE OBJECT the object would end at 50 degrees.
function vertsoff(object,offx as float,offy as float,offz as float)
lock vertexdata for limb object,0,2
for c=0 to get vertexdata vertex count()-1
set vertexdata position c,get vertexdata position x(c)+offx,get vertexdata position y(c)+offy,get vertexdata position z(c)+offz
next c
unlock vertexdata
endfunction
function vertscale(object,scale)
lock vertexdata for limb object,0,2
local temp as float
temp=scale/100.0
for c=0 to get vertexdata vertex count()-1
set vertexdata position c,get vertexdata position x(c)*temp,get vertexdata position y(c)*temp,get vertexdata position z(c)*temp
next c
unlock vertexdata
endfunction
function vertrotate(object,xangle as float,yangle as float,zangle as float)
lock vertexdata for limb object,0,2
local posx as float
local posy as float
local posz as float
for c=0 to get vertexdata vertex count()-1
posx=get vertexdata position x(c)
posy=get vertexdata position y(c)
posz=get vertexdata position z(c)
`xrotate
if xangle<>0
ang#=atanfull(posz,-posy)-90
dist#=SQRT(posz*posz+posy*posy)
posz=dist#*cos(ang#+xangle)
posy=dist#*sin(ang#+xangle)
endif
`yrotate
if yangle<>0
ang#=atanfull(posx,-posz)-90
dist#=SQRT(posz*posz+posx*posx)
posx=dist#*cos(ang#+yangle)
posz=dist#*sin(ang#+yangle)
endif
`zrotate
if zangle<>0
ang#=atanfull(posx,-posy)-90
dist#=SQRT(posx*posx+posy*posy)
posx=dist#*cos(ang#+zangle)
posy=dist#*sin(ang#+zangle)
endif
set vertexdata position c,posx,posy,posz
next c
unlock vertexdata
endfunction
EDIT: Added Lock flags of 2 to make sure changes stick.
Latest progress: Fog of War implemented