-----Original Message-----
������: zhouhj <[EMAIL PROTECTED]>
�ռ���: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
����: zhouhj <[EMAIL PROTECTED]>
����: 2000-10-26 20:11
����: �ظ�: <lingo-l> 3D with lingo
>Hi Lingo Fellows! goodnight!
>
>---------First of all, we can put the following script into movie script of
>the projector.
>
>
> global gCorners, gCenter, gRectList, gRotate, gPlane
>
>on startMovie
> -- initialize lists for a cube
> initBox
>end
>
>on frameScript
> -- add to rotation based on mouse location
> gRotate = gRotate - (float(the mouseH-320)/30)*pi()/100
>
> -- calc plane tilt based on mouse location
> gPlane = - (float(the mouseV-240)/30)*pi()/20
> drawSides
>end
>
>on initBox
> -- list of corners with x, y and z coordinates
> gCorners =
>[[-60,-60,-60],[60,-60,-60],[60,60,-60],[-60,60,-60],[-60,-60,60],[60,-60,6
0
>],[60,60,60],[-60,60,60]]
>
> -- the screen center
> gCenter = point(320,240)
>
> -- list of sides
> -- each side has four corners
> gRectList = [[1,2,3,4],[1,2,6,5],[3,4,8,7],[2,3,7,6],[1,4,8,5],[5,6,7,8]]
>end
>
>on drawSides
> -- generate a list of screen points and depths based on the
> -- gCorners list and the transformation to 2d screen coordiantes
> list = []
> repeat with i = 1 to count(gCorners)
> temp = plotPoint(gCorners[i])
> add list,temp
> end repeat
>
> -- create a quad list that takes four points to display a side of the
cube
> quadList = [:]
> repeat with i = 1 to count(gRectList)
>
> -- get the four corners that make this side
> thisRect = gRectList[i]
>
> -- get the four screen points to draw
> q = [list[thisRect[1]][2],list[thisRect[2]][2],?
> list[thisRect[3]][2],list[thisRect[4]][2]]
>
> -- get the closest (depth) screen point
> z = min(list[thisRect[1]][1],list[thisRect[2]][1],?
> list[thisRect[3]][1],list[thisRect[4]][1])
>
> -- add to list, with closest screen point as the property name
> addProp quadList, z, q
> end repeat
>
> -- sort list by property name so closest sides get drawn ontop of farther
>ones
> sort quadList
>
> -- draw each side
> repeat with i = 1 to count(gRectList)
> sprite(i).quad = quadList[i]
> end repeat
>end
>
>
>
>
>on plotPoint objectInfo
> -- get x, y, and z from objectInfo list
> x = getAt(objectInfo,1)
> y = getAt(objectInfo,2)
> z = getAt(objectInfo,3)
>
> -- TRANSFORM BY ROTATION AROUND Z
>
> -- compute the radius
> radius = sqrt(x*x+y*y)
>
> -- compute the angle
> if x = 0.0 then angle = atan(the maxInteger)
> else angle = atan(float(y)/x)
> if y < 0 then angle = angle + pi()
>
> -- rotate
> set angle = angle+gRotate
>
> -- compute new x, y, and z
> realX = radius*cos(angle)
> realZ = radius*sin(angle)
> realY = Z
>
> -- TRANSFORM BY ROTATION AROUND X
>
> -- compute then radius
> radius = sqrt(realY*realY+realZ*realZ)
>
> -- compute the angle
> if realZ = 0 then angle = atan(the maxInteger)
> else angle = (atan(realY/realZ))
> if realZ < 0 then angle = angle + pi()
>
> -- rotate
> angle = angle - gPlane
>
> -- compute then new x, y and z
> screenX = realX
> screenY = radius*sin(angle)
> screenZ = radius*cos(angle)
>
> -- return both z, and the x and y point
> return [screenZ,point(screenX,screenY)+gCenter]
>end
>
>
>-----------then, Adding the script into behavior script of the score
>
>
>on exitFrame
> frameScript
> go to the frame
>end
>
>that is all !
good-bye
>
>
>
>
>
>
>
>
>
>
>
>-----Original Message-----
>������: limiar40 b <[EMAIL PROTECTED]>
>�ռ���: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>����: 2000-10-26 19:35
>����: <lingo-l> 3D with lingo
>
>
>>HI LIST
>>
>>1- How can I make a 3d cube(outline) in director with lingo?
>>2- It's possible to rotate the cube in any direction, on mouse
interaction?
>>example: When the mouse rolls to the right side of the stage, the cube
>>rotate's to right,
>>and if the mouse go's to the left side, the cube rotate's to the left.
>>
>>
>>thaks
>>Limiar
>>_________________________________________________________________________
>>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>>
>>Share information about yourself, create your own public profile at
>>http://profiles.msn.com.
>>
>>
>>[To remove yourself from this list, or to change to digest mode, go to
>>http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
>>email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
>>Lingo-L is for learning and helping with programming Lingo. Thanks!]
>>
>
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]