measure the height of a model - Macromedia Director 3D

how can i measure the height of a model?...

1. measure the height of a model

how can i measure the height of a model?
just_mik3 Guest 2. Re: measure the height of a model

You need to walk through all the vertices of the model, checking for the
minimum and maximum y-value.

You'll find a handler below that does this. You can get the height of model 1
of member "3D" as follows:

vBox = GetBoundingBox(member("3D").model(1))
put vBox
-- [#xMin: -14.9212, #xMax: 14.9212, #yMin: -12.1142, #yMax: 12.1142, #zMin:
-18.6146, #zMax: 18.6146]

vHeight = vBox.yMax - vBox.yMin
put vHeight
-- 24.2285

on GetBoundingBox(a3DModel)
vModifiers = a3DModel.modifier
if not vModifiers.getPos(#meshDeform) then
vRemoveModifier = TRUE
end if

xMin = the maxInteger
yMin = the maxInteger
zMin = the maxInteger

xMax = -the maxInteger
yMax = -the maxInteger
zMax = -the maxInteger

vMeshCount = a3DModel.meshDeform.mesh.count
repeat with vMesh = 1 to vMeshCount
vVertexList = a3DModel.meshDeform.mesh[vMesh].vertexList

i = vVertexList.count
repeat while i
vVertex = vVertexList[i]

x = vVertex.x
if xMin > x then
xMin = x
else if xMax < x then
xMax = x
end if

y = vVertex.y
if yMin > y then
yMin = y
else if yMax < y then
yMax = y
end if

z = vVertex.z
if zMin > z then
zMin = z
else if zMax < z then
zMax = z
end if

i = i - 1
end repeat
end repeat

if vRemoveModifier then
a3DModel.removeModifier(#meshDeform)
end if

vBoxList = [:]
vBoxList[#xMin] = xMin
vBoxList[#xMax] = xMax
vBoxList[#yMin] = yMin
vBoxList[#yMax] = yMax
vBoxList[#zMin] = zMin
vBoxList[#zMax] = zMax

return vBoxList
end GetBoundingRect

openspark Guest  Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•