
DOWNLOAD THE 3dD BASIC KIT
The 3dD Basic Kit is a FREE basic scenery where you can make the exercices of our tutorial.
The kit has a basic 3ds max world: kitb.max that is only a floor
and a Director world : kitb.dir. The movie has four scripts: setupscript avatarobj cameraobj and timestep
Normaly you will put YOUR code in the avatarobj script using one of the two methods:
new - for one-time execution code or control - for code inside the timestep-loop.
In our lessons we will use the 3dD Basic Kit like a pre-requirement for the exercices
and make references to it.
To download the files right-click the links, saving the target in your PC:
Why every tutorial about 3D has this infamous "rotating boxes"? I don't know. Perhaps because they are an easy example of rotation.
In Director we have, for rotation:
myworld.model("object").transform.rotate(myworld.model("object"), upvect, r)
upvect is the vector that defines the base axis of rotation.
The important resource that Director has is that we can define the pivot axis of the rotation. In our general statement above we used: myworld.model("object") like an argument defining that , the pivot axis is in the center of object. But think about a pivoting door: the pivot axis is not in the center of the door! We can create a hinge. The center of the hinge will be the pivot axis.
The most correct general statement for rotation is:
myworld.model("object").transform.rotate(myworld.model("object of the axis of rotation"), upvect, r)
We will make a demo of a pivoting door in the next lesson. Now, lets go to create our infamous "dancing cube". Really will be not a cube. We will rotate our plaque with logo.
In our 3dD Basic Kit we have a script glued to the frame where is the sprite of the world. The timestep script. We will put the code there:
on prepareframe me
global avatarobj, cameraobj, myworld
control avatarobj
control cameraobj
myworld.model("logo").transform.rotate(myworld.model("logo").worldposition, avatarobj.upvect, 2)
end
on exitFrame me
go the frame
end
What is new, is in red.
Important to note that: the base axis is declared using a definition created inside the avatarobj script. So: the declaration is: avatarobj.upvect.
We are using the prefix myworld; so: we need to declare this object like a global property.
Look! The logo is dancing :-)
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
