Adobe ATMOSPHERE User Manual page 295

Table of Contents

Advertisement

frog.jumpAwayFrom(theActor.position);
}
moveTo(Vector position)
This method schedules an update to the position property using a smooth interpolation over the next time step
period. This smooth kinematic motion is more stable when other objects collide with the current object. By the
next time step the velocity and acceleration will be set to zero.
target = stageModel.getPrimitive("Target");
theActor.moveTo(target.position);
transformTo(transform)
This method schedules an update to the actor's orientation and position properties using a smooth interpolation
over the next time step period. This smooth kinematic motion is more stable when other objects collide with the
current object. By the next time step, the velocity, acceleration, angular velocity, and angular acceleration will be
set to zero.
anchor = stageModel.getPrimitive("anchor");
theActor.transformTo(anchor.transform);
alignHeadAndBodyTo(Rotation)
Given the Rotation, aligns the body subject to the constraint that it can only rotate around the y-axis, and aligns
the head subject to the constraint that it can only rotate around a horizontal axis relative to the body.
// Given a subject, align the actor to look at it
deltaPos
= theActor.position.subtract(subject.position);
actorRange
= Math.sqrt(deltaPos.x*deltaPos.x +
actorRangeXZ = Math.sqrt(deltaPos.x*deltaPos.x +
actorPitch
= Math.atan2(-deltaPos.y, actorRangeXZ);
actorYaw
= Math.atan2(deltaPos.x, deltaPos.z);
targetOrientation = Rotation('YX', actorYaw, actorPitch);
theActor.alignHeadAndBodyTo(targetOrientation);
getBodyOrientation()
Returns the Transform representing the actor's body orientation. Note that the actor's body does not tilt up and
down, only rotates around the world's y-axis.
// Calculate the actor's body's yaw
bodyOrientation
= theActor.getBodyOrientation().map(Vector(0,0,1));
bodyYaw
= Math.atan2(bodyOrientation.z, bodyOrientation.x);
getHeadOrientation()
The Transform representing the orientation of the actor's head.
deltaPos.y*deltaPos.y +
deltaPos.z*deltaPos.z);
deltaPos.z*deltaPos.z);
283
ADOBE ATMOSPHERE
User Guide

Advertisement

Table of Contents
loading

Table of Contents