HBhvTargetObject

Functions

HBhvTargetObject

char const *

GetName

char const *

GetPath

HC_KEY

GetTargetKey

void

SetTargetKey

char const *

GetResolvedPath

char const *

GetType

bool

IsEqual

HBhvCameraType

GetCameraType

void

SetPivot

void

SetCollision

bool

GetCollision

void

SetPivot

void

GetPivot

HPoint *

GetPivot

void

Serialize

void

FlagForCollision

void

ResetForCollision

bool

HasMoved

void

SetSerializeFromKey

void

ResolveTarget

void

CreateTargetString

void *

XMLCallback

Detailed Description

class HBhvTargetObject

The HBhvTargetObject class encapsulates various target types for animations and sensors.

HBhvTargetObject is 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”

Public Functions

HBhvTargetObject(HBhvBehaviorManager *behaviourmanager, char const *name, char const *path, HPoint *pivot = 0)

Constructs an HBhvTargetObject object.

Parameters
  • behaviourmanager – A pointer to HBhvBehaviorManager object 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

inline char const *GetName()
Returns

The name of this target object.

inline char const *GetPath()
Returns

The path associated with this target object. Aliases are not expanded.

HC_KEY GetTargetKey()
Returns

The key of target object if applicable.

inline void SetTargetKey(HC_KEY key)
inline char const *GetResolvedPath()
Returns

The path of target object with aliases fully expanded and no type descriptor.

inline char const *GetType()
Returns

Type of target object. This can be HKEY, ANIM for animation, SPATH for segment and SSR for sensor.

bool 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.

inline HBhvCameraType GetCameraType()
Returns

The camera type for this target object.

inline void SetPivot(HPoint pv)

Sets the center of rotation for this target object.

Parameters

pv – The pivot point.

inline void 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.

inline bool GetCollision()
Returns

Returns true if the target should be evaluated for collisions.

inline void 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.

inline void GetPivot(HPoint &pv)

Returns the center of rotation for the target object.

inline HPoint *GetPivot()
Returns

Center of rotation for target object.

void Serialize(HUtilityXMLGenerator *xmlgen)

Writes the XML data for this target object.

Parameters

xmlgen – A pointer to the xml generator that creates correct xml blocks

inline void FlagForCollision()

Call this method to indicate that this object has moved and should be checked for collision with other objects.

inline void ResetForCollision()

Call this method indicates this object has not moved and does not need to be checked for collisions with other objects.

inline bool HasMoved()
Returns

True if the object has moved during a particular animation slice or false if it has not.

inline void SetSerializeFromKey(bool sfk)

Public Static Functions

static void ResolveTarget(char const *in, char *result, char *targettype, HBaseModel *model, HBhvCameraType &ctype)

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 HBaseModel object.

  • ctype – Returns the camera type.

static void CreateTargetString(char const *type, char const *path, char *result, bool addquotes = false)

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 methods HBhvBehaviorManager::AddAnimation and HBhvBehaviorManager::FindAnimation to 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 *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData)

This is XML read callback which parses XML data and then populates the member variables with the associated values.