View Single Post
Junior Member
Status: Offline
Posts: 14
Join Date: Jun 2008
Default 06-20-2008, 03:50 PM

Here is the code that does it... for those who are interested:

edu.cmu.cs.stage3.alice.core.Element[] heads = namedHeadCriterion );
if( (heads != null) && (heads.length > 0) ) {
	edu.cmu.cs.stage3.alice.core.Element head = heads[0];
	if( head instanceof edu.cmu.cs.stage3.alice.core.Transformable ) {
		edu.cmu.cs.stage3.alice.core.Camera camera = authoringTool.getCurrentCamera();
		if( camera != null ) {
			edu.cmu.cs.stage3.alice.core.response.PointAtAnimation pointAt = new edu.cmu.cs.stage3.alice.core.response.PointAtAnimation();
			pointAt.subject.set( head ); camera );
			pointAt.duration.set( new Double( .5 ) );
			doInOrder.componentResponses.add( pointAt );
			edu.cmu.cs.stage3.alice.core.response.Wait wait2 = new edu.cmu.cs.stage3.alice.core.response.Wait();
			wait2.duration.set( new Double( .4 ) );
			doInOrder.componentResponses.add( wait2 );
Code: namedHeadCriterion );
returns an array of elements (sub-objects) that meet the "namedHeadCriterion", that is, those that are named "head". (I'm leaving out the "namedHeadCriterion" code)
if( (heads != null) && (heads.length > 0) )
means "if we found a piece named 'head' in the model".

is our element named "head". Since objects can't be named the same thing there can be only one.

The rest of the code is more obvious.. it just sets up the PointAtAnimation (turn the subject, "head," to point at the target, "camera") and does it. (helpful hint: in the Alice code "methods" are referred to as "responses")
oxygen vaporizer
Mexico Hotels

Last edited by jedavis; 05-11-2011 at 04:53 AM.
Reply With Quote