ART GALLERY 1 - LOOKING UP/DOWN


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:
kitb.dir - 52kb kitb.max - 197 kb
You can see a demo of the world at: 3dD Basic Kit demo-world

If you are an artist (and who is not?) you have some hidden works that now you can show to the world creating your own 3D gallery. The visit can walk looking your works and, clicking, can go to a detailed description of it in other web page.

In the first lesson of this serie we will learn how to make the avatar to look up and down - to see all your beautiful work :-)

Do you remember who is the avatar?

There are the variable: cameraoffset that represents the position of the camera related to aux and to the avatar object.

If we vary the elements of the array we can change the camera angle and the vision of the avatar-player.

We will use two keyboard keys to control this movement: a and z but you can choose another if you like.

We will change the cameraobj script of our 3dD Basic Kit (the new lines are bolded):

property mycam   
property aux  
property cameraoffset 
global avatarobj,myworld 
property camy
property camx

on new me
  camx = -0.002 
  camy = 0.001

  aux = myworld.newmodel("aux")
  mycam = myworld.camera[1]
  aux.visibility = #none
  mycam.projectionangle = 95 
  
  return me  
end

on control me
  
  cameraoffset = [camx,camy]
  if keypressed("a") then
    camx = camx - 0.0015 
    camy = camy + 0.001
  end if 
  
  if keypressed("z") then
    camx = camx - 0.0015 
    camy = camy - 0.001
  end if   
  
  
  -- the same
  aux.transform.interpolateto(myworld.model("avatar").getworldtransform(),  100.0)
  camvect = (avatarobj.upvect*cameraoffset[1]+ avatarobj.fwvect*cameraoffset[2])
  aux.translate(camvect, #world)
  aux.pointat(myworld.model("avatar").worldposition ) 
  lag = 100
  mycam.transform.interpolateto(aux.getworldtransform(), lag)  
end

We will have some distortions if the angle is very big. It's possible to create limits to this angle creating limits to camx and camy.

Play the demo going inside the building (the gallery) and looking the "painting". The demo is complete - we will learn the other resources (link and change of the pointer image) in next lessons.




PREVIOUS LESSON NEXT LESSON
T. CONTENTS HOMEPAGE