Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / total noob
  RSS 2.0 ATOM  

total noob
Rate this thread
 
63558
 
Permlink of this thread  
avatar
  • Total Posts: 1
  • Joined: 14 January 2012 01:52 AM

I am new to maxscript (but I use 3d studio for 15 years)

I wanted to make a simple script which moves an object as a harmonic oscilator.
There are tutorials online, but I want to do it myself from scratch, to learn basics of scripting. So, first basics are needed. To the point:

The maxscript help file says:

“Moving an object in MAXScript is very simple:
move name_obj [<x,y,z>]
where name_obj is the name of the object you want to move and <x,y,z> is the amount you want it to move.”

BUT: when I create a box called mybox
and I run the script, which is simply

move mybox [<10,0,0]>]

I get an error:

>> MAXScript FileIn Exception:—No “"move"” function for undefined <<

What am I doing wrong?



Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

Where does it say that exactly? The correct definition is:

move <node> <point3>

Where node is a reference to the actual node, not its name.
point3 is a Point3 value - essentially an array of 3 values [x, y, z]
If you reset Max then create a Box, its name will be “Box001”

To move that box via Maxscript you would have to either

move $Box001 [10,10,10]

or

move (getNodeByName "Box001"[10,10,10]

Important - move is a Relative move - not an absolute position in the world. Use:-

<node>.pos [10,10,10]

to move it to a specific world location.

If you intend move on to more generalised scripts, avoid the “$” method as it restricts the script to working with objects with specific names. Even better, avoid the getNodeByName if you can for the same reason, although that method does allow, for example, a user to enter the name of the object they want to use. Better to make them select the object before running the script, or to remove the user from the equation entirely and iterate over all the Box objects in the scene.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0