HBhvTargetObject
-
class
HBhvTargetObject The
HBhvTargetObjectclass encapsulates various target types for animations and sensors.HBhvTargetObjectis mainly used in conjunction with animations and sensors to describe a segment path in the HOOPS database but it can also point to a named animation or sensor. The target string consists of the target type followed by the target descriptor.“HKEY: ” : A unique key identifying the object Example: Target = “HKEY: 123”
“SPATH:” : A segment path corresponding to the HSF segment structure. SCENE and MODEL are reserved keywords (they refer to the model segment and scene segment as defined in MVO). Specifying SCENE as the segment name can be useful to make global color changes or to do camera movement. “CAMERAPOS” and “CAMERATARGET” are reserved keywords that refer to the camera of the scene. Translation and quaternion rotation will be applied to the camera position/orientation. Camera manipulation will usually require separate animations performed in conjunction. One for the camera movement (using the POS interpolator), one for the camera orientation (using QUAT or EULER) and one for zooming in/out (using the scale interpolator). For “orbit” types of camera animation it is usually preferable to animate the cameratarget, while for walkthroughs the camera position should be used. The camera keywords can appear at the end of a target statement.This is useful if multiple cameras in the scene need to be manipulated. Examples: Target = “SPATH: MODEL/car/wheel1” Target = “SPATH: SCENE/CAMERATARGET”
“ANIM:” The name of an animation tag Example: Target = “ANIM: a1”
“SSR:” The name of a Sensor tag Example: Target = “SSR: s1”
Index
Methods
CollapseTarget()CreateTargetString()FlagForCollision()GetCameraType()GetCollision()GetName()GetPath()GetPivot()GetPivot()GetResolvedPath()GetTargetKey()GetType()HasMoved()HBhvTargetObject()IsEqual()ResetForCollision()ResolveTarget()Serialize()SetCollision()SetPivot()SetPivot()SetSerializeFromKey()SetTargetKey()XMLCallback()
Variables
Methods
-
HBhvTargetObject::HBhvTargetObject(HBhvBehaviorManager *behaviourmanager, char const *name, char const *path, HPoint *pivot = 0) Constructs an
HBhvTargetObjectobject.Parameters
behaviourmanager: A pointer to
HBhvBehaviorManagerobject that is associated with this target object.name: The name of target object.
path: The target description. You can use CreateTargetString to generate the path for this target object.
pivot: Sets the center of rotation if the target object is a segment in the HOOPS segment hierachy
-
char const *
HBhvTargetObject::GetName() Returns
The name of this target object.
-
char const *
HBhvTargetObject::GetPath() Returns
The path associated with this target object. Aliases are not expanded.
-
HC_KEY
HBhvTargetObject::GetTargetKey() Returns
The key of target object if applicable.
-
void
HBhvTargetObject::SetTargetKey(HC_KEY key)
-
char const *
HBhvTargetObject::GetResolvedPath() Returns
The path of target object with aliases fully expanded and no type descriptor.
-
char const *
HBhvTargetObject::GetType() Returns
Type of target object. This can be HKEY, ANIM for animation, SPATH for segment and SSR for sensor.
-
bool
HBhvTargetObject::IsEqual(char const *target) Compares this target object with another one to determine equality.
Parameters
target: Pass a target descriptor string. You can generate this string using the CreateTargetString method.Returns
False if they are not equal or true if they are equal.
-
HBhvCameraType
HBhvTargetObject::GetCameraType() Returns
The camera type for this target object.
-
void
HBhvTargetObject::SetPivot(HPoint pv) Sets the center of rotation for this target object.
Parameters
pv: The pivot point.
-
void
HBhvTargetObject::SetCollision(bool collision) This method allows you to indicate if you want this object to be evaluated for collisions. Any collision between this object and the environment will trigger a HAnimationListener::ObjectCollisionEvent event, which can in turn be received by any class deriving from HAnimationListener. This allows an application to be aware of inter-object collisions during an animation and provide visual feedback on the (typically by highlighting the collided objects).
Parameters
collision: Pass true if you want this object to be evaluated for collision.
-
bool
HBhvTargetObject::GetCollision() Returns
Returns true if the target should be evaluated for collisions.
-
void
HBhvTargetObject::SetPivot(float x, float y, float z) Sets the center of rotation for the target object.
Parameters
x: The x coordinate position of the pivot point.
y: The y coordinate position of the pivot point.
z: The z coordinate position of the pivot point.
-
void
HBhvTargetObject::GetPivot(HPoint &pv) Returns the center of rotation for the target object.
-
HPoint *
HBhvTargetObject::GetPivot() Returns
Center of rotation for target object.
-
void
HBhvTargetObject::Serialize(HUtilityXMLGenerator *xmlgen) Writes the XML data for this target object.
Parameters
xmlgen: A pointer to the xml generator that creates correct xml blocks
-
void
HBhvTargetObject::FlagForCollision() Call this method to indicate that this object has moved and should be checked for collision with other objects.
-
void
HBhvTargetObject::ResetForCollision() Call this method indicates this object has not moved and does not need to be checked for collisions with other objects.
-
bool
HBhvTargetObject::HasMoved() Returns
True if the object has moved during a particular animation slice or false if it has not.
-
void
HBhvTargetObject::SetSerializeFromKey(bool sfk)
-
static void
HBhvTargetObject::ResolveTarget(char const *in, char *result, char *targettype, HBaseModel *model, HBhvCameraType &ctype) static
Given an unexpanded target descriptor, this method returns the corresponding HOOPS segment path, target type and camera type for this target object.
Parameters
in: The target string to evaluate.
result: Returns the expanded target string.
targettype: Returns the type of target.
model: Pointer to
HBaseModelobject.ctype: Returns the camera type.
-
static void
HBhvTargetObject::CreateTargetString(char const *type, char const *path, char *result, bool addquotes = false) static
This utitlity method combines a target type and path to one target into one string. The generated name can be used as an identifier to pass to the method
IsEqual()and the methodsHBhvBehaviorManager::AddAnimationandHBhvBehaviorManager::FindAnimationto identify a target by a string.Parameters
type: The type of the target such as HKEY, SPATH, ANIM or SSR(sensor).
path: If the type is SPATH, path is the path to the segment. If the type is HKEY, then path is the unique HKEY identifier. If type is ANIM or SSR, then pass a the name.
result: Returns a pointer to the combined target string.
addquotes: Pass true if target string should be enclosed by quotation marks or false if you don’t want quotes.
-
static void *
HBhvTargetObject::XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData) static
This is XML read callback which parses XML data and then populates the member variables with the associated values.
-
static void
HBhvTargetObject::CollapseTarget(char const *target, char *collapsedtarget) protected static
This method is for internal use only.
Variables
-
char
HBhvTargetObject::m_Name[MVO_SMALL_BUFFER_SIZE] protected
charThe name of this target object.
-
char
HBhvTargetObject::m_Path[MVO_SEGMENT_PATHNAME_BUFFER] protected
charThe unresolved path.
-
char
HBhvTargetObject::m_ResolvedPath[MVO_SEGMENT_PATHNAME_BUFFER] protected
charThe resolved path.
-
char
HBhvTargetObject::m_Type[MVO_SMALL_BUFFER_SIZE] protected
charThe target type.
-
HC_KEY
HBhvTargetObject::m_key protected
HC_KEYThe key of target object.
-
HBhvBehaviorManager *
HBhvTargetObject::m_pBehaviorManager protected
A pointer to BehaviorManager object that this animation belongs to.
-
HBhvCameraType
HBhvTargetObject::m_CameraType protected
The type of camera.
-
HPoint
HBhvTargetObject::m_Pivot protected
The center of rotation.
-
bool
HBhvTargetObject::m_bCollision protected
boolA flag indicating if this object should be evaluated for collisions.
-
bool
HBhvTargetObject::m_bHasMoved protected
boolA flag indicating if object has moved during one animation slice.
-
bool
HBhvTargetObject::m_bSerializeFromKey protected
bool