Professional Documents
Culture Documents
on endSprite(me)
me.setModelTransform(pModelTransformOriginList)
end endSprite
----------------------------------on rotateAllModels(me)
repeat with j = 1 to me.getModels(pMember, []).count
case pAxisRotation of
"X":
me.rotateX(j)
"Y":
me.rotateY(j)
"Z":
me.rotateZ(j)
end case
end repeat
end rotateAllModels
----------------------------------on rotateSingleModel(me)
case pAxisRotation of
"X":
me.rotateX(pModel)
"Y":
me.rotateY(pModel)
"Z":
me.rotateZ(pModel)
end case
end rotateSingleModel
----------------------------------on rotateX(me, aModel)
case pMember.type of
#text:
tCenterPointAndRadius = pMember.model[1].boundingSphere
tCenter = tCenterPointAndRadius[1]
pMember.model[1].rotate(tCenter, vector(1,0,0), pSpeed,#world)
otherwise:
pMember.model(aModel).rotate(pSpeed,0,0)
end case
end rotateX
--------------------------------on rotateY(me, aModel)
case pMember.type of
#text:
tCenterPointAndRadius = pMember.model[1].boundingSphere
tCenter = tCenterPointAndRadius[1]
pMember.model[1].rotate(tCenter, vector(0,1,0), pSpeed,#world)
otherwise:
pMember.model(aModel).rotate(0,pSpeed,0)
end case
end rotateY
---------------------------------------------------------------------------------Predefined Handlers-------------------------------------------------------------------------------------------------------------------------------------------PURPOSE: Determines whether the behavior can be dropped onto a sprite in the s
core.
--ACCEPTS: 'aScript' as a reference to a script member.
-'aSpriteType' as a symbol. It indicates the type of sprite attempting
---
to be dropped on to.
'aSpriteNum' as an integer. Indicates the channel of the sprite being
-dropped on to.
--RETURNS: True if the behavior is allowed to be dropped on the sprite or score,
-false otherwise.
----------------------------------on isOKtoAttach(aScript, aSpriteType, aSpriteNum)
case aSpriteType of
#Graphic:
case sprite(aSpriteNum).member.type of
#shockwave3d:
if aScript.getModels(sprite(aSpriteNum).member, []).count > 0 then
return(TRUE)
else
return(FALSE)
end if
#text:
if sprite(aSpriteNum).member.displayMode = #mode3D then
return(TRUE)
end if
end case
#script:
return(FALSE)
end case
return(FALSE)
end isOKtoAttach
------------------------------------PURPOSE: Allows the user a dialog box access to the behavior's properties.
--ACCEPTS: 'aScript' as a reference to a script member.
--RETURNS: 'TGPDList' as a property list containing author definable behavior pr
operties
----------------------------------on getPropertyDescriptionList(aScript)
if the currentSpriteNum > 0 then
tGPDList = [:]
tGPDList[#pSpeed] = \
[#comment:"Rotation speed",\
#format: #integer,\
#range:[#min:-20, #max:20],\
#default: 5]
tList = ["Rotate All"]
tList = aScript.getModels(sprite(the currentSpriteNum).member, tList)
if tList.count > 2 then
tGPDList[#pModel] = \
[#comment:"Which model?",\
#format: #string,\
#range: tList,\
#default: tList[1]]
else
nothing
--There is only one model in the member. So, don't offer a selection
--as to which model to rotate.
end if
tGPDList[#pAxisRotation] = \
[#comment:"Which axis to rotate about",\
#format: #string,\
#range:["X", \
"Y", \
"Z"],\
#default: "X"]
return(tGPDList)
end if
end getPropertyDescriptionList
------------------------------------PURPOSE: Provides a tooltip in the behavior library palette.
--ACCEPTS: 'aScript' as a reference to a script member.
--RETURNS: 'tString' as a string.
----------------------------------on getBehaviorToolTip(aScript)
tString1 = "Automatically rotates a model" & RETURN & RETURN
tString2 = "-" && "Type" && ":" && "Independent Action" & RETURN
tString3 = "-" && "Dependencies" && ":" && "None"
return(tString1 & tString2 & tString3)
end getBehaviorToolTip
------------------------------------PURPOSE: Provides a behavior description in the behavior inspector.
--ACCEPTS: 'aScript' as a reference to a script member.
--RETURNS: 'tString' as a string.
----------------------------------on getBehaviorDescription(aScript)
tString1 = "AUTOMATIC MODEL ROTATION" & RETURN & RETURN & \