Sign in to follow this  

Coordinate types in 3ds max

This topic is 2661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ehhh, I'm really not sure if I'm in the right forum, please move me if I'm not.

So I'm trying to make my 3ds max automatically generate bounding shapes about various meshes, and I'm stuck trying to find the center for them. I tried to calculate the middle of all the vertices but I have found no way of converting it to the coordinate system of the mesh. Here is my 3ds max code:

for obj in selection do
(
verts=obj.mesh.verts
for vertex in verts do
(
top = maxvector top vertex.pos //top is the vector for the positive corner of the bounding shape
bot = minvector bot vertex.pos //bot is the negative corner
pos = pos + vertex.pos //this is my attempt to calculate the center
)
pos=pos/obj.mesh.numverts
if gr.checked==false then
(
local params=top-bot
local center= pos
mybox = createbox params center //create a box
top=[0,0,0]
bot=[0,0,0]
)
)
//here is the function that create the box
fn createbox params center =
(
mybox=box length:params.y width:params.x height:params.z
mybox.center=center
mybox
)



I can not just put it in the center of the object, because I plan to have multiple shapes in an object based on selected vertices (like around vertices affected by one specific bone in a skinned mesh). So what am I doing wrong?

Share this post


Link to post
Share on other sites

This topic is 2661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this