Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
DM Transition Pack 1
Set PlayBackMode Property of a Animated Gif Cast Member
Director in Other Programs
Indeo Video
Border Xtra
myScreen
ECD
DisplayRes
Set Frame Rate for Flash Member
WebXtra
MediaMacros Xtras Mall
 

 

 

Behavior 3D controller example

Added on 1/31/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

Rating:

Author: KimNordström

Basic 3D COntroler Example

Download PC Source    Download Mac Source
--More examples available at http://www.piggelin.com/macromedia/examples.htm
-- Created by kim@nevermind.net -99
-- If you´ll use this script please notify me so i can see what cool stuff you´ve made...

global ca, cb, cc
global sa, sb, sc
global a, b, c
global x1, y1, z1, xp, yp, zp, xg, yg, zg
global lineCnt, lineComb, pointCnt
global zSort

on startmovie
  a = 0.0
  b = 0.0
  c = 0.0
  x1 = [-10,10,10,-10,-10,10,10,-10]
  --x1 = [-30,-10,-10,-30,-30,-10,-10,-30]
  y1 = [-10,-10,10,10,-10,-10,10,10]
  z1 = [10,10,10,10,-10,-10,-10,-10]
  lineComb = [[1,2,3,4],[2,6,7,3],[7,8,4,3],[4,8,5,1],[2,1,5,6],[6,5,8,7]]
  lineCnt = lineComb.count
  pointCnt = x1.count
  xp = []
  yp = []
  zp = []
  xg = 1
  yg = 5
  zg = 2
  repeat with t = 1 to lineCnt
    puppetsprite t, true
  end repeat
end

on t  
  av = 50
  siz = 10.0
  --siz = the mouseH / 60.0
  ca = cos(a)
  cb = cos(b)
  cc = cos(c)
  sa = sin(a)
  sb = sin(b)
  ac = sin(c)
  repeat with t = 1 to pointCnt
    x = x1[t]
    y = y1[t]
    z = z1[t]
    nx = x*cb*cc + y*(sa*sb*cc + ca*sc) + z*(sa*sc - ca*sb*cc)
    ny = x*cb*sc + y*(ca*cc - sa*sb*sc) + z*(ca*sb*sc + sa*cc)
    nz = x*sb - y*sa*cb + z*ca*cb
    rx = (nx * av/(nz + av))*siz
    ry = (ny * av/(nz + av))*siz
    xp[t] = integer(rx + 200)
    yp[t] = integer(ry + 200)
    zp[t] = (-nz * 5) + 128
  end repeat
  zSort = [:]  
  repeat with cntLines = 1 to lineCnt
    sumTemp = 0
    repeat with koords = 1 to 4
      sumTemp = sumTemp + zp[lineComb[cntLines][koords]]
    end repeat
    sumTemp = sumTemp / 4
    zSort.addProp(sumTemp, cntLines)
  end repeat
  sort zSort
  repeat with setZ = 1 to lineCnt
    sprite(zSort[setZ]).locZ = setZ
  end repeat
  repeat with t = 1 to lineCnt
    tt = []
    tt[1] = [ xp[lineComb[t][1]] , yp[lineComb[t][1]] ]
    tt[2] = [ xp[lineComb[t][2]] , yp[lineComb[t][2]] ]
    tt[3] = [ xp[lineComb[t][3]] , yp[lineComb[t][3]] ]
    tt[4] = [ xp[lineComb[t][4]] , yp[lineComb[t][4]] ]
    --sprite(t).membernum = (t+14)
    sprite(t).quad = tt
  end repeat
  a = a + xg * 3.14 / 270    -- y
  b = b + yg * 3.14 / 270    -- x
  --c = c + zg * 3.14 / 180    -- z
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail