Date: Wed, 19 Nov 1997 12:03:01 -0800 From: Eric BlanpiedHere's a bit of lingo to do it.Subject: Re: QTVR Object panning >I am currently working on a project using alot of QTVR. The QTVRs are >all object movies of bones, skulls and so forth. When the user stops on >a frame of the QTVR the user then has the option to turn on labels that >Identify parts of that bone. The problem is that we can not make labels >for each of the frames(to much work), so we have selected every couple >of frames. When the user turns on the labels if the user is not on the >exact frame the labels are on it, has a slight jump as the labels come >on. I have come up with two scripts that will allow me to do this but I >am trying to come up with a cross between the two.
It's a handler called swingObjectMoive, and it relies on parameters for ending pan and tilt angles, as well as a number of steps to do the swing in. It doesn't always pick the shortest direction to pan in, but it always winds up at the correct orientation. My math skills are not so great, so if anyone sees the solution to getting it to pan the shortest direction every time, let me know. It's effects are best seen with an object with a large tilt range.
The handler is written to be used with the BasicVR.cst file which is on the Director 6 CD, as well as in the download package.
-- SwingObjectMovie ----------------
--
-- Swings an object from it's current orientation to a specified destination.
-- Parameters passed are:
-- endPan: destination pan angle
-- endTilt: destination titl angle
-- panRate: number of steps to swing
------------------------------------
on swingObjectMovie endPan, endTilt, panRate
global gQTVRObj -- as used in BasicVR.cst
-- get starting parameters from current orientation
set startPan = QTVRGetPanAngle(gQTVRObj)
set startTilt = QTVRGetTiltAngle(gQTVRObj)
-- set Pan parameters
set hDir = -1
set panAmount = startPan - endPan
-- make sure it's the shortest amount
if panAmount > 180 then set panAmount = 360 - panAmount
-- and panning the proper direction
if startPan > endPan + 180 then set hDir = 1
set panStep = float(panAmount) / panRate
set newPan = startPan
-- set Tilt parameters ----
set tiltAmount = startTilt - endTilt
set vDir = -1
if tiltAmount > 180 then set tiltAmount = 360 - tiltAmount
if startTilt > endTilt + 180 then set vDir = 1
set tiltStep = float(tiltAmount) / panRate
set newTilt = startTilt
-- do the swing
repeat with x = 1 to panRate
set newPan = string(newPan + (panStep*hDir))
set newTilt = string(newTilt + (tiltStep*vDir))
QTVRSetPanAngle(gQTVRObj, newPan)
QTVRSetTiltAngle(gQTVRObj, newTilt)
QTVRUpdate(gQTVRObj)
end repeat
end
Eric Blanpied