ScriptSpot

Forum topic · Scripts Wanted

3D Object Inserter

By james120479 · 2009-08-18

Description

Does anyone know if a script exists for inserting / merging an existing 3D model / object into a scene file and dropping onto a surface where picked? i.e. you have a model of a car in a seperate max file and want to drop this onto a surface in your scene, dropping at the point you specify with a click of a mouse

Comments (2)

Anubis · 2009-09-16

Quote from MXS Reference: "Scripted Mouse Tools"

-- HERE IS A SIMPLE EXAMPLE
tool foo
(
   local b
   on mousePoint clickno do
      if clickno == 1 then b = box pos:worldPoint else #stop
   on mouseMove clickno do b.pos = worldPoint
)
/* This tool allows the user to click in a viewport at which point a box is created. Dragging the mouse positions the box and releasing the mouse button stops the tool. */
-- YOU WOULD START THIS TOOL BY EXECUTING:
startTool foo

So, whats next? Need to see how merge and import works (Ref: "3ds Max File Loading and Saving").

-- Merge file
f = getMAXOpenFileName()
if (isMaxFile f) do mergeMAXFile f

-- Import file
f = getOpenFileName()
if f != undefined do importFile f

This is short uncompleted example, just to show you only how easy it to make your own script using Max helps files. Also if you can't find a script that cover your specific needs, you can downloads similar scripts and modify or learn from them.