Notifications
Clear all
[Closed] Get Gravity-Point of 3D Node ?
Jan 18, 2010 9:12 am
Hi, everybody !
I’m trying to define or get the gravity point of a 3d object with maxscript. It is possible to get it by the standard script or Utility ?
if anybody know a solution ?!
thanks
3 Replies
Jan 18, 2010 9:12 am
What do you mean by gravity point? You mean the pivot?
selection[1].pivot
-Johan
Jan 18, 2010 9:12 am
Ok, I’m sorry… the gravity point is not the good word.
I want to say, “Mass Center(pivot)”. the pivot of object mass and not the 3ds pivot of node.
expression of Mass :
mass = density / volume
Sorry for may English !
Jan 18, 2010 9:12 am
in the utility panel, the ‘Measure’ tool, or:
in the mxs help, there is a topic called: how to calculate the volume of an object.
point pos:(
local obj = snapshotAsMesh $
local faceNum = obj.numfaces
local face,vx,vy,vz,dV
local volume = Float 0
local center = point3 0 0 0
for i = 1 to faceNum do
(
face = getFace obj i
vz = getVert obj Face.z
vy = getVert obj Face.y
vx = getVert obj Face.x
dV = dot (cross (vy - vx) (vz - vx)) vx
volume += dV
center += (vx + vy + vz) * dV
)
volume/=6
center/=24
center/=volume
center
) wirecolor:yellow