07.12.2012 Views

Adobe Director Basics

Adobe Director Basics

Adobe Director Basics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ADOBE DIRECTOR BASICS<br />

3D: Controlling action<br />

The camera is now behind the camera at the optimal distance, and will not collide with any walls.<br />

Sample code<br />

Here's a simplified version of the Third-Person Camera script:<br />

-- pointer to the 3D member<br />

property p3DMember<br />

-- pointer to the camera object that is<br />

-- controlled by this instance. This<br />

-- instance is added to pCamera.userData<br />

property pCamera<br />

-- radius of cylinder around the parent<br />

-- node = minimum distance of pCamera from<br />

-- parent<br />

property pRadius<br />

-- maximum distance of pCamera from parent<br />

property pMaxDistance<br />

-- [#maxNumberOfModels: 1,<br />

-- #levelOfDetail: #detailed<br />

-- #modelList: ]<br />

property pRayInfo<br />

-- pointer to the parent of pCamera = the<br />

-- node that pCamera will follow<br />

property pParent<br />

-- initial transform of pCamera,<br />

-- representing its vertical position at<br />

-- the center of the cylinder surrounding<br />

-- the parent node.<br />

property pTransform<br />

on new(me, a3DMember, aRadius, aMaxDistance, aBarrierList)<br />

p3Dmember = a3DMember<br />

pRadius = aRadius<br />

pMaxDistance = aMaxDistance<br />

pRayInfo = [:]<br />

pRayInfo[#maxNumberOfModels] = 1<br />

pRayInfo[#levelOfDetail] = #detailed<br />

pRayInfo[#modelList] = aBarrierList<br />

pCamera = p3DMember.camera(1)<br />

pParent = pCamera.parent<br />

pTransform = pCamera.transform.duplicate()<br />

(pCamera.userData)[#followCamera] = me<br />

end new<br />

Last updated 8/26/2011<br />

232

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!