EZScreenPlacement Class Reference

Inherits IUseCamera.

List of all members.

Public Types

enum  HORIZONTAL_ALIGN {
  NONE, SCREEN_LEFT, SCREEN_RIGHT, SCREEN_CENTER,
  OBJECT
}
 

Specifies what the object will be aligned relative to on the horizontal axis.

More...
enum  VERTICAL_ALIGN {
  NONE, SCREEN_TOP, SCREEN_BOTTOM, SCREEN_CENTER,
  OBJECT
}
 

Specifies what the object will be aligned relative to on the vertical axis.

More...

Public Member Functions

void PositionOnScreenRecursively ()
 Positions the object, taking into account any object-relative dependencies, making sure the objects to which this object is relative are correctly positioned before positioning this one.
Vector3 ScreenPosToLocalPos (Vector3 screenPos)
 Calculates a local position from a given screen or object-relative position, according to the current screen-space settings.
Vector3 ScreenPosToParentPos (Vector3 screenPos)
 Calculates a in the parent's local space from a given screen or object-relative position, according to the current screen-space settings.
Vector3 ScreenPosToWorldPos (Vector3 screenPos)
void PositionOnScreen ()
 Repositions the object using the existing screen-space settings.
void PositionOnScreen (int x, int y, float depth)
 Positions the object using screen coordinates, according to the relativity settings stored in relativeToScreen.
void PositionOnScreen (Vector3 pos)
 Positions the object using screen coordinates, according to the relativity settings stored in relativeToScreen.
void SetCamera ()
 A no-argument version of SetCamera() that simply re-assigns the same camera to the object, forcing it to recalculate all camera-dependent calculations.
void SetCamera (Camera c)
 Sets the camera to be used for calculating positions.

Public Attributes

Camera renderCamera
 The camera with which this object should be positioned.
Vector3 screenPos = Vector3.forward
 The position of the object, relative to the screen or other object.
bool ignoreZ = false
 When set to true, the Z component of Screen Pos will be calculated based upon the distance of the object to the render camera, rather than controlling the distance to the render camera. Enable this option, for example, when you want to preserve parent-relative positioning on the Z-axis.
RelativeTo relativeTo
 Settings object that describes what this object is positioned relative to.
Transform relativeObject
 The object to which this object is relative. NOTE: Only used if either the vertical or horizontal elements of relativeTo are set to OBJECT (or both).
bool alwaysRecursive = true
 When true, positioning of the object is always done in a recursive fashion. That is, if this object is relative to any other objects, those objects, should they also hold an EZScreenPlacement component, will be positioned before this one.
bool allowTransformDrag = false
 When checked, you can simply use the transform handles in the scene view to roughly position your object in the scene, and the appropriate values will be automatically calculated for Screen Pos based on your other settings. If you're having problems with slight rounding errors making small changes to your Screen Pos coordinate, you should probably uncheck this option. This is particularly likely to happen if your camera is rotated at all.

Properties

Camera RenderCamera [get, set]
 Accessor for the camera that will be used to render this object. Use this to ensure the object is properly configured for the specific camera that will render it.
Vector3 ScreenCoord [get]
 Retrieves the screen coordinate of the object's current position.

Detailed Description

A class that eases the process of placing objects on-screen in a screen-relative, or object-relative way, using pixels as units of distance.


Member Enumeration Documentation

Specifies what the object will be aligned relative to on the horizontal axis.

Enumerator:
NONE 

The object will not be repositioned along the X axis.

SCREEN_LEFT 

The X coordinate of screenPos will be interpreted as the number of pixels from the left edge of the screen.

SCREEN_RIGHT 

The X coordinate of screenPos will be interpreted as the number of pixels from the right edge of the screen.

SCREEN_CENTER 

The X coordinate of screenPos will be interpreted as the number of pixels from the center of the screen.

OBJECT 

The X coordinate of screenPos will be interpreted as the number of pixels from the object assigned to horizontalObj. i.e. negative values will place this object to the left of horizontalObj, and positive values to the right.

Specifies what the object will be aligned relative to on the vertical axis.

Enumerator:
NONE 

The object will not be repositioned along the Y axis.

SCREEN_TOP 

The Y coordinate of screenPos will be interpreted as the number of pixels from the top edge of the screen.

SCREEN_BOTTOM 

The Y coordinate of screenPos will be interpreted as the number of pixels from the bottom edge of the screen.

SCREEN_CENTER 

The Y coordinate of screenPos will be interpreted as the number of pixels from the center of the screen.

OBJECT 

The Y coordinate of screenPos will be interpreted as the number of pixels from the object assigned to verticalObj. i.e. negative values will place this object above verticalObj, and positive values below.


Member Function Documentation

void EZScreenPlacement.PositionOnScreen ( Vector3  pos  ) 

Positions the object using screen coordinates, according to the relativity settings stored in relativeToScreen.

Parameters:
pos The X and Y screen coordinates where the object should be positioned, as well as the Z coordinate which represents the distance in front of the camera.
void EZScreenPlacement.PositionOnScreen ( int  x,
int  y,
float  depth 
)

Positions the object using screen coordinates, according to the relativity settings stored in relativeToScreen.

Parameters:
x The number of pixels in the X axis relative to the position specified in relativeToScreen.
y The number of pixels in the Y axis relative to the position specified in relativeToScreen.
depth The distance the object should be in front of the camera.
void EZScreenPlacement.PositionOnScreen (  ) 

Repositions the object using the existing screen-space settings.

void EZScreenPlacement.PositionOnScreenRecursively (  ) 

Positions the object, taking into account any object-relative dependencies, making sure the objects to which this object is relative are correctly positioned before positioning this one.

Vector3 EZScreenPlacement.ScreenPosToLocalPos ( Vector3  screenPos  ) 

Calculates a local position from a given screen or object-relative position, according to the current screen-space settings.

Parameters:
screenPos The screen/object-relative position
Returns:
The corresponding position in local space.
Vector3 EZScreenPlacement.ScreenPosToParentPos ( Vector3  screenPos  ) 

Calculates a in the parent's local space from a given screen or object-relative position, according to the current screen-space settings.

Parameters:
screenPos The screen/object-relative position
Returns:
The corresponding position in the parent object's local space.
Vector3 EZScreenPlacement.ScreenPosToWorldPos ( Vector3  screenPos  ) 

Calculates the world position from a given screen or object-relative position, according to the current screen-space settings.

Parameters:
screenPos The screen/object-relative position
Returns:
The corresponding position in world space.
void EZScreenPlacement.SetCamera ( Camera  c  ) 

Sets the camera to be used for calculating positions.

Parameters:
c 
void EZScreenPlacement.SetCamera (  ) 

A no-argument version of SetCamera() that simply re-assigns the same camera to the object, forcing it to recalculate all camera-dependent calculations.


Member Data Documentation

When checked, you can simply use the transform handles in the scene view to roughly position your object in the scene, and the appropriate values will be automatically calculated for Screen Pos based on your other settings. If you're having problems with slight rounding errors making small changes to your Screen Pos coordinate, you should probably uncheck this option. This is particularly likely to happen if your camera is rotated at all.

When true, positioning of the object is always done in a recursive fashion. That is, if this object is relative to any other objects, those objects, should they also hold an EZScreenPlacement component, will be positioned before this one.

When set to true, the Z component of Screen Pos will be calculated based upon the distance of the object to the render camera, rather than controlling the distance to the render camera. Enable this option, for example, when you want to preserve parent-relative positioning on the Z-axis.

The object to which this object is relative. NOTE: Only used if either the vertical or horizontal elements of relativeTo are set to OBJECT (or both).

Settings object that describes what this object is positioned relative to.

The camera with which this object should be positioned.

Vector3 EZScreenPlacement.screenPos = Vector3.forward

The position of the object, relative to the screen or other object.


Property Documentation

Camera EZScreenPlacement.RenderCamera [get, set]

Accessor for the camera that will be used to render this object. Use this to ensure the object is properly configured for the specific camera that will render it.

Vector3 EZScreenPlacement.ScreenCoord [get]

Retrieves the screen coordinate of the object's current position.


The documentation for this class was generated from the following file:

Generated on Thu Sep 8 16:31:16 2011 for EZ GUI by  doxygen 1.6.1