Ovis_Viewmode_Follow_Set()
Abstract
Sets 3D Network Visualizer to the Follow view mode.
Syntax
Ovis_Viewmode_Follow_Set (entity, offset, orientation)
| Argument | Type | Description |
|---|---|---|
entity |
OvisT_Entity * |
Ovis entity |
offset |
OvisT_3D_Body_Offset |
Struct of doubles giving the offsets of the viewpoint from the entity in meters forward, right, and down |
orientation |
OvisT_TaitBryan |
Struct of doubles specifying the look direction of the viewpoint as a rotation of psi (z), theta (y), and phi (x) degrees |
Return Type
OvisT_Compcode
OvisC_Compcode_Success if the operation could be performed; OvisC_Compcode_Failure otherwise.
Header
ovis_entity.h
Details
This function modifies the current view mode in 3D Network Visualizer to a follow mode attached to the specified entity.
Example
OvisT_Entity * entity;
double ent_yaw;
OvisT_3D_Position ent_pos, vp_pos;
OvisT_3D_Body_Offset offset;
OvisT_TaitBryan orientation;
/* entity created at some point */
/* Get entity geocentric position and heading */
Ovis_Entity_Position_Get (entity, &ent_pos, OPC_NIL);
Ovis_Entity_Attr_Get_Dbl (entity, “yaw”, &ent_yaw);
/* Calculate viewpoint offset for 10 meters behind entity */
offset.forward = -10 * cos (ent_yaw);
offset.right = -10 * sin (ent_yaw);
offset.down = 0;
/* Calculate viewpoint orientation looking toward entity */
vp_pos = ent_pos;
vp_pos.x += offset.forward;
vp_pos.y += offset.right;
Ovis_3D_Position_Orientation_TaitBryan_Get (vp_pos, 0, 45, 0, &orientation);
Ovis_Viewmode_Follow_Set (entity, offset, orientation);
Errors
- Entity is NIL.
Reference
- Use other
Ovis_Viewmode_xxx_Setfunctions to change the view to different modes. - Use the function Ovis_3D_Position_Orientation_TaitBryan_Get() to obtain a Tait-Bryan rotation based on a specified position and orientation.