gamedesignteam

MOBILE GAMES, IPHONE APPLICATIONS, COMPUTER GAMES, GAME DEVELOPMENT TRAINING , http://www.gamedesignteam.com

  • game design team

    We have emerged as the leading online community for game development of all levels. Our expertise encases all facets for writing PC , Mobile and Online of 2D and 3D Gaming programming and applications development, for instance by using the latest 3D engines, scripting languages and animation techniques, our experienced and qualified team deals with all kind of requirements, whether it be a beginner's choice or an expert gaming action. Most importantly, we endeavor to offer compelling solution and eminent support to our growing community of prospective players and customers.

3D max Script tutorial

Posted by virtualinfocom On 12:26 AM 1 comments

I'll hopefully do a few of these over the next while. I'll start off really really basic for those who have always wanted to learn maxscript but haven't been able to get started. (that was me for a long time!)



The best way to learn maxscript is to learn a few basic tricks that you can use in your everyday work. You can then extend your knowledge as you come across tasks that you can *almost do with your current knowledge.



Intro



Ok, first of all I'll go over a few basics.



To follow allong with these tuts, open the maxscript listener by


hitting F11.



The pink area up the top is the listener where if you enable the


macrorecorder, it will tell you what max is doing in maxscript


terms as you do regular tasks in max. We won't pay attention to


this area in this tut.



The white area is where everything will be happening. Delete the


"Welcome to maxscript" message so we have a blank slate to start


with.



The Basics



Create a sphere in the scene so we have an object to talk to.



There are two simple ways to refer to an existing scene object in


max. You can select it and refer to the selection or you can refer


to it by name. The way maxscript refers to objects is by their


name with a $ in front. So to refer to the sphere you just


created, type:



$Sphere01



Now, with the cursor at the end of that, hit the enter on the


numeric keypad. That will execute the current line. If you want to


execute more than one line, select them all and hit numeric enter.



once you hit enter, maxscript will return the following in blue:

$Sphere:Sphere01 @ [10,-5,0]



The last numbers will vary depending on where you created the


sphere in the scene.

This is confirmation that you are talking about the sphere and


that your syntax is correct.



Object Attributes



Now lets try something slightly more useful. Type:



$Sphere01.radius



and hit numeric enter to execute. maxscript will return the radius


of the sphere!

Notice how there is a hierarchy to the command. You started with


the object itself then a period (.) then the parameter belonging


to the object. You can refer to other parameters the same way. ie;



$Sphere01.segments will return the segments value.



Setting attribute values



Now what we want to do is change the values not just look at them.



Simply type:



$Sphere01.segments = 35



You'll notice as soon as you execute the line, the sphere changes


it's segments to 35!

Well you could have done that faster with the GUI right? What if


you have 25 spheres all with different radii and you want to just


change their segment count? (a common problem)



Working on selections of many objects



I referred earlier to the fact we can refer to objects by


referring to the current selection. In maxscript the shortcut to


this is to simply select an object (select your sphere) and type:



$



When you execute this, you'll get the same result as if you had


typed $Sphere01

Now we are going to exploit the power of "mapped functions"



Create 10 spheres of random radii and position. Select them all.


Now type the following and execute it:



$.segments = 10



All the spheres will retain all their setting except the segments


on all of them will be set to 10.



Thats it for now!



Conclusion



Play around with other objects and other attributes.

if you want to know what parameters are availiable to you on a


given object, type:



showproperties $



For the sphere, that will return the following list:



.smooth : boolean

.radius : float

.segs : integer

.mapcoords : boolean

.slice : boolean

.hemisphere : float

.sliceFrom : angle

.sliceTo : angle

.chop : integer

.recenter : boolean

.realWorldMapSize : boolean

false

virtualinfocom

Categories:

1 Response for the "3D max Script tutorial"

  1. This comment has been removed by the author.

Post a Comment