Ask a Question related to Macromedia Director 3D, Design and Development.
-
Bazmati webforumsuser@macromedia.com #1
problems with adding Camera as child to object
Heres the problem.
If I simply parent my camera to the pCamPar model
all the rotation is skewed ie. The pCamPar posotion is not exactly the same as the camera.
So I tried getting the current camera position/rotation and putting the vectors in camPosition/camRotation variables. Then set the position/rotation of pCamPar to these. When I test this the message window displays the pCamPar and camera are in the exact same position but I can see the pCamPar model in front of the camera at vector(0,0,0) (I assume ?cant test it ?cause the message window says its at the camera pos.)
The model moves with the cam but the cam rotations center point is at the models visible location.
It does the same thing if I set the pCamera position/rotation with a fixed vector
If I set the pCamera and pCamPar with fixed vectors it works.
This doesn?t make sense because if the camera was at vector(0,50,0) for example and you made a variable of that vector and passed it to the pCamPar shouldn?t that do the same as what the working script is doing?
Does anyone have an Idea
Thanks, Rhys
[email]rhysburnie@hotmail.com[/email]
HERES THE SCRIPT
on beginSprite me
---------------
gTriggerYes=0
gWhichMod=0
---------------
p3dMember = sprite(me.spriteNum).member
pSprite = sprite(me.spriteNum)
pCamera = pSprite.camera
pDownArrow = FALSE
pLeftArrow = FALSE
pRightArrow = FALSE
GET CAMRERA POSITION
-- camPosition=p3dMember.camera[1].transform.position
-- camRotation=p3dMember.camera[1].transform.rotation
-- camPosition=vector(0,50,0)
-- camRotation=vector(0,0,0)
pCamera.transform.position=vector(0,50,0)
pCamera.transform.rotation=vector(0,0,0)
-- create 'parent' Sphere ------------------------------
p3dMember.deleteModelResource("cameraPar") -- deletes if allready exists
camPar = p3dMember.newModelResource("cameraPar",#Sphere)
camPar.radius=10
p3dMember.deleteModel("cameraPar") --delete existing "cameraShere" Model
pCamPar = p3dMember.newModel("cameraPar",camPar)
-- pCamPar.transform.position=camPosition
-- pCamPar.transform.rotation=camRotation
pCamPar.transform.position=vector(0,50,0)
pCamPar.transform.rotation=vector(0,0,0)
-----------------------------------------------------
--
-- create the camera's bounding sphere --------------
p3dMember.deleteModelResource("cameraSphere") -- deletes if allready exists
camSphere = p3dMember.newModelResource("cameraSphere",#sphere)
camSphere.radius = 100
p3dMember.deleteModel("cameraSphere") --delete existing "cameraShere" Model
pCameraSphere = p3dMember.newModel("cameraSphere",camSphere)
-----------------------------------------------------
--
-- create a light to carry with the camera
p3dMember.deleteLight("cameraLight") --delete existing "cameraLight"
camLight = p3dMember.newLight("cameraLight",#point)
camLight.color = rgb(170,170,170)
-- PARENT ITEMS -------------------------------------
-- make pCameraBox parent of pCamera
pCamPar.addChild(pCamera, #preserveParent)
-- make pCameraSphere & camLight children of pCamera
pCamera.addChild(pCameraSphere,#preserveParent)
pCamera.addChild(camLight,#preserveParent)
-- register the member for regular timeMS events in order to respond to
-- user input and resolve camera collisions
p3dMember.registerForEvent(#timeMS,#controlCamera, me,2500,50,0)
end
Bazmati webforumsuser@macromedia.com Guest
-
how to tell if an object is a model or a camera
hello; I have a repeat loop that goes through all the children of a model; however my camera is parented to the model also; when the loop gets to... -
Camera rotation around an object
Is there any easy way to duplicate the sort of camera rotation found in Director's 3D preview window? -That is, where horizontal mouse movement... -
adding multiple child records
i have an access database set up with 2 tables: tblContacts, and tblNotes tblNotes is related to tblContacts by a field caled ContactID i have... -
child object oddity
I have a parent script and in it I noticed that a SendAllSprites call to a handler in a script attached to a sprite on the stage wasn't getting to... -
child object on demand?
I have an application that suffers from my amateur coding inefficiencies, and I am trying to clean a few things up. I have an extremely database... -
Karl Sigiscar #2
Re: problems with adding Camera as child to object
Hello,
Instead of setting the parent of the camera to the pCamPar model, use the
addChild() lingo instruction:
pCamPar.addChild(pCamera, #preserveWorld)
The #preserveWorld parameter of the addChild() lingo instruction allows to
keep the relative position intact when attaching nodes to one another.
Karl.
Karl Sigiscar Guest



Reply With Quote

