RSX Code Reference
    Preparing search index...

    Class Gizmos

    The Gizmos class provides rendering and picking of gizmo elements.

    Gizmos are icons and 3D objects usually rendered in scene view for various visualization purposes. For example a Camera component will have a gizmo that draws a camera icon since otherwise it has no visual representation. Aside from being rendered, gizmos can also be selected by the user as if they were normal scene elements.

    To add a gizmo to a scene, apply the @drawGizmo decorator to a static method.

    Index
    • Returns Gizmos

    • get cameraWorldPosition(): Immutable<Vector3>

      Get the world space position of the camera that the gizmos are being rendered for.

      Returns Immutable<Vector3>

    • get cameraWorldRotation(): Immutable<Quaternion>

      Get the world space rotation of the camera that the gizmos are being rendered for.

      Returns Immutable<Quaternion>

    • get farFadeDistance(): number

      Sets the distance at which gizmos start to fade out.

      Returns number

    • set farFadeDistance(value: number): void

      Parameters

      • value: number

      Returns void

    • get gizmoIconColor(): SRGBColor

      The default color of an icon. This changes based on whether the current icon is selected.

      Returns SRGBColor

    • get isDepthFadeEnabled(): boolean

      Enables or disables the depth fading for further draw calls.

      Returns boolean

    • set isDepthFadeEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get isDepthTestEnabled(): boolean

      Determines if depth-testing is enabled (Default: Enabled)

      Returns boolean

    • set isDepthTestEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get isOcclusionTintEnabled(): boolean

      Enables depth testing, and renders the occluded portion with a tinted color. (Default: False)

      Returns boolean

    • set isOcclusionTintEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • set layer(value: rsx.LayerMask): void

      Sets the layer bitfield that controls whether a handle is considered visible in a specific camera. Handle layer must match camera layer in order for the camera to render it

      Parameters

      Returns void

    • get nearFadeDistance(): number

      Sets the distance at which gizmos start to fade out near the camera.

      Returns number

    • set nearFadeDistance(value: number): void

      Parameters

      • value: number

      Returns void

    • get occlusionTintColor(): Immutable<SRGBColor>

      Changes the color used for occlusion tint in any further gizmo draw calls.

      Returns Immutable<SRGBColor>

    • set occlusionTintColor(value: Immutable<SRGBColor>): void

      Parameters

      Returns void

    • get screenPositionOffset(): Immutable<Vector2>

      Set the screen space offset for further draw calls. Only applies to solid and text gizmos.

      Returns Immutable<Vector2>

    • set screenPositionOffset(value: Immutable<Vector2>): void

      Parameters

      Returns void

    • get worldMatrix(): Immutable<Matrix4>

      Changes the transform that will be applied to meshes of any further gizmo draw calls.

      Returns Immutable<Matrix4>

    • set worldMatrix(value: Immutable<Matrix4>): void

      Parameters

      Returns void

    • get worldPosition(): Immutable<Vector3>

      Gets the position of the transform that will be applied to further draw calls

      Returns Immutable<Vector3>

    • get worldRotation(): Immutable<Quaternion>

      Gets the rotation of the transform that will be applied to further draw calls

      Returns Immutable<Quaternion>

    • get worldScale(): Immutable<Vector3>

      Gets the scale of the transform that will be applied to further draw calls

      Returns Immutable<Vector3>

    • Aligns the transform of any further draw calls with the camera.

      Returns void

    • Draws a double-sided solid arc.

      Parameters

      • position: Immutable<Vector3>

        Center of the arc.

      • normal: Immutable<Vector3>

        Orientation of the arc, pointing in the direction the arc is visible in.

      • radius: number

        Radius of the arc.

      • startAngle: rsx.Degree

        Angle at which to start the arc.

      • amountAngle: rsx.Degree

        Length of the arc.

      Returns void

    • Draws a flat arrow.

      Parameters

      • from: Immutable<Vector3>

        Starting point of the arrow

      • to: Immutable<Vector3>

        End point of the arrow.

      • normal: Immutable<Vector3>

        Normal of the arrow.

      • width: number

        Width of the line of the arrow.

      • tipLength: number

        Length of the triangle tip. Does not influence overall length of the arrow (the line gets shorter instead)

      • tipWidth: number

        Width of the triangle tip.

      • OptionaltipOffset: number

        Moves the tip along the line of the arrow.

      • OptionaldoubleEnded: boolean

        Whether the arrow has tips on both ends.

      Returns void

    • Draws a mesh representing 2D text facing the camera with the specified properties.

      Parameters

      • position: Immutable<Vector3>

        Position to render the text at. Text will be centered around this point.

      • text: string

        Text to draw.

      • font: Font | ResourceHandle<Font>

        Font to use for rendering the text's characters.

      • OptionalfontSize: number

        Size of the characters, in points.

      • Optionalanchor: Immutable<Vector2>

        Anchor for placement. Vector2(0, 0) is the top left, Vector(1, 1) bottom right.

      • OptionalisUsingPixelPerfectLayout: boolean

        If true, the actual size in pixels of the text is used to layout it relative to the anchor.

      • OptionalmaximumWidth: number

        Maximum width of the text. If it is wider, it will be broken into multiple lines.

      Returns void

    • Draws a solid cone.

      Parameters

      • coneBase: Immutable<Vector3>

        Position of the center of the base of the cone.

      • normal: Immutable<Vector3>

        Orientation of the cone, pointing from center base to the tip of the cone.

      • height: number

        Height of the cone (along the normal).

      • radius: number

        Radius of the base of the cone.

      • scale: Immutable<Vector2>

        Scale applied to cone's disc width & height. Allows you to create elliptical cones.

      Returns any

    • Draws a solid cone.

      Parameters

      • coneBase: Immutable<Vector3>

        Position of the center of the base of the cone.

      • normal: Immutable<Vector3>

        Orientation of the cone, pointing from center base to the tip of the cone.

      • height: number

        Height of the cone (along the normal).

      • radius: number

        Radius of the base of the cone.

      Returns any

    • Draws a cone shaped angle limit, e.g for a spherical joint.

      Parameters

      • position: Immutable<Vector3>

        The position at which to draw the limit.

      • normal: Immutable<Vector3>

        The direction in which the angle is considered zero.

      • radius: number

        The size of the cone used to visualize the limit.

      • limit: rsx.Degree

        The angle of the limit cone in degrees.

      Returns void

    • Draws an axis aligned cuboid.

      Parameters

      Returns void

      Must be called between startGizmo/endGizmo calls.

    • Draws a solid cylinder.

      Parameters

      • base: Immutable<Vector3>

        Position of the center of the base of the cylinder.

      • normal: Immutable<Vector3>

        Orientation of the cone, pointing from center base to the top of the cylinder.

      • height: number

        Height of the cylinder (along the normal).

      • radius: number

        Radius of the cylinder.

      • Optionalscale: Immutable<Vector2>

        Scale applied to cylinder's disc width & height. Allows you to create elliptical cones.

      Returns void

    • Draws a solid disc.

      Parameters

      • position: Immutable<Vector3>

        Center of the disc.

      • normal: Immutable<Vector3>

        Orientation of the disc, pointing in the direction the disc is visible in.

      • radius: number

        Radius of the disc.

      Returns void

    • Draws a wireframe frustum.

      Parameters

      • position: Immutable<Vector3>

        Origin of the frustum, or the eye point.

      • aspect: number

        Ratio of frustum width over frustum height.

      • FOV: rsx.Degree

        Horizontal field of view in degrees.

      • near: number

        Distance to the near frustum plane.

      • far: number

        Distance to the far frustum plane.

      Returns void

      Must be called between startGizmo/endGizmo calls.

    • Draws an icon Image at the specified scene position.

      Parameters

      • position: Immutable<Vector3>

        The position at which to draw the icon.

      • image: Image

        The image to use as the icon.

      • fixedScale: boolean

        Whether to use a fixed scale for the icon regardless of camera distance.

      • Optionalanchor: Immutable<Vector2>

        The anchor point of the icon, defaults to center (0.5, 0.5).

      Returns void

    • Draws a list of lines. Provided array must contain pairs of the line start point followed by an end point.

      Parameters

      Returns void

      Must be called between startGizmo/endGizmo calls.

    • Draws a solid mesh.

      Parameters

      Returns void

    • Draws a solid torus mesh representing a handle orbit.

      Returns void

    • Draws a double-sided solid rectangle.

      Parameters

      Returns void

    • Draws a double-sided solid rectangle with rounded cornders.

      Parameters

      Returns void

    • Draws a solid skeleton.

      Parameters

      • skeleton: Skeleton

        The skeleton to draw.

      • OptionalboneTransforms: Immutable<Matrix4>[]

        The optional bone transforms to override the default skeleton pose.

      • OptionalboneColors: SRGBColor[]

        The optional bone colors to override the current color.

      Returns void

    • Draws a sphere.

      Parameters

      Returns void

      Must be called between startGizmo/endGizmo calls.

    • Draws a mesh representing 2D text with the specified properties.

      Parameters

      • position: Immutable<Vector3>

        Position to render the text at. Text will be centered around this point.

      • direction: Immutable<Vector3>

        Direction of the text baseline in 3D space.

      • up: Immutable<Vector3>

        Up direction of the text in 3D space.

      • text: string

        Text to draw.

      • font: Font | ResourceHandle<Font>

        Font to use for rendering the text's characters.

      • OptionalfontSize: number

        Size of the characters, in points.

      • Optionalanchor: Immutable<Vector2>

        Anchor for placement. Vector2(0, 0) is the top left, Vector(1, 1) bottom right.

      • OptionalisUsingPixelPerfectLayout: boolean

        If true, the actual size in pixels of the text is used to layout it relative to the anchor.

      • OptionalmaximumWidth: number

      Returns void

    • Draws a solid torus.

      Parameters

      • orientation: Immutable<Quaternion>

        The orientation of the torus.

      • radius: number

        The radius of the torus.

      • tubeRadius: number

        The tube radius of the torus.

      • quality: number

        The quality of subdivision of the torus.

      Returns void

    • Draws a wireframe arc.

      Parameters

      • position: Immutable<Vector3>

        Center of the arc.

      • normal: Immutable<Vector3>

        Orientation of the arc, pointing in the direction the arc is visible in.

      • radius: number

        Radius of the arc.

      • startAngle: rsx.Degree

        Angle at which to start the arc.

      • amountAngle: rsx.Degree

        Length of the arc.

      Returns void

    • Draws a wireframe capsule.

      Parameters

      • position: Immutable<Vector3>

        World coordinates of the center of the capsule.

      • height: number

        Distance between the centers of the capsule's hemispheres.

      • radius: number

        Distance of each point from the capsule's center-line.

      Returns void

    • Draws a wireframe cone.

      Parameters

      • coneBase: Immutable<Vector3>

        Position of the center of the base of the cone.

      • normal: Immutable<Vector3>

        Orientation of the cone, pointing from center base to the tip of the cone.

      • height: number

        Height of the cone (along the normal).

      • radius: number

        Radius of the base of the cone.

      Returns any

    • Draws a wireframe cone.

      Parameters

      • coneBase: Immutable<Vector3>

        Position of the center of the base of the cone.

      • normal: Immutable<Vector3>

        Orientation of the cone, pointing from center base to the tip of the cone.

      • height: number

        Height of the cone (along the normal).

      • radius: number

        Radius of the base of the cone.

      • scale: Immutable<Vector2>

        Scale applied to cone's disc width & height. Allows you to create elliptical cones.

      Returns any

    • Draws a wireframe axis aligned cuboid.

      Parameters

      Returns void

      Must be called between startGizmo/endGizmo calls.

    • Draws the corners of a wireframe cuboid.

      Parameters

      • position: Immutable<Vector3>

        Center of the cuboid.

      • extents: Immutable<Vector3>

        Size of the cuboid.

      • cornerSize: number

        Size of the drawn corners.

      • OptionalisCornerSizeRelative: boolean

        If true, cornerSize is interpreted as a fraction of extents. Otherwise, cornerSize is the absolute size of the corners.

      Returns void

    • Draws a wireframe cylinder.

      Parameters

      • base: Immutable<Vector3>

        Position of the center of the base of the cylinder.

      • normal: Immutable<Vector3>

        Orientation of the cylinder, pointing from center base to the top of the cylinder.

      • height: number

        Height of the cylinder (along the normal).

      • radius: number

        Radius of the cylinder.

      • Optionalscale: Immutable<Vector2>

        Scale applied to cylinder's disc width & height. Allows you to create elliptical cones.

      Returns void

    • Draws a wireframe disc.

      Parameters

      • position: Immutable<Vector3>

        Center of the disc.

      • normal: Immutable<Vector3>

        Orientation of the disc, pointing in the direction the disc is visible in.

      • radius: number

        Radius of the disc.

      Returns void

    • Draws a wireframe hemisphere represented by three arcs.

      Parameters

      Returns void

      Must be called between startGizmo/endGizmo calls.

    • Parameters

      Returns void

    • Draws a wireframe rectangle.

      Parameters

      Returns void

    • Draws a skeleton.

      Parameters

      • skeleton: Skeleton

        The skeleton to draw.

      • OptionalboneTransforms: Immutable<Matrix4>[]

        The optional bone transforms to override the default skeleton pose.

      • OptionalboneColors: SRGBColor[]

        The optional bone colors to override the current color.

      Returns void

    • Draws a skeleton bone.

      Parameters

      • bonePosition: Immutable<Vector3>

        The position of the joint (or start of the bone).

      • parentPosition: Immutable<Vector3>

        The position of the parent bone.

      • radius: number

        The radius of the bone.

      • detached: boolean

        If true, only lines will be drawn to the parent, and no cones

      • OptionalboneColor: Immutable<SRGBColor>

        Color of the bone

      • OptionalparentColor: Immutable<SRGBColor>

        Color of the parent bone

      Returns void

    • Draws a wireframe sphere represented by three discs.

      Parameters

      Returns void

      Must be called between startGizmo/endGizmo calls.

    • Calculates the size of an icon in world space.

      Parameters

      • image: Image

        The icon's image.

      • isFixedScale: boolean

        Whether the icon has a fixed scale on the screen.

      • position: Immutable<Vector3>

        The icon's position. Only used when isFixedScale is true;

      Returns Vector2

      The size of the icon, in world space.

    • Calculates the size of the given icon in pixels.

      Parameters

      • image: Image

        The icon to calculate the size for.

      • isFixedScale: boolean

        Whether the icon has a fixed scale on the screen, not depending on the distance to the camera.

      • position: Immutable<Vector3>

        Position of the icon. Relative to the transform set in SetTransform.

      Returns Vector2

      The exact size of the icon on the screen, in pixels.

    • Calculates the size of the given text in world space.

      Parameters

      • text: string

        The text to calculate the size of.

      • font: Font | ResourceHandle<Font>

        The font of the text.

      • OptionalfontSize: number

        The font size.

      • OptionalisPixelPerfect: boolean

        If true will calculate only the size of the pixels actually affected. Otherwise line spacing and other empty space will be included in the size.

      • OptionalmaximumWidth: number

        Maximum width of the text. If it is wider, it will be broken into multiple lines.

      Returns Vector2

      The size of the rectangle the text will occupy, in world space.

    • Calculates the size of the given text in pixels. Assumes the text is facing the camera and located at the position set with SetTransform.

      Parameters

      • text: string

        The text to calculate the size for.

      • font: Font | ResourceHandle<Font>

        The font of the text.

      • OptionalfontSize: number

        Font size of the text.

      Returns Vector2

      The exact size of the text on the screen, in pixels.

    • Calculates how big (in pixels) a rectangle with the given size, facing the camera, would be at the given position.

      Parameters

      • worldSpaceSize: Immutable<Vector2>

        The world space size of the rectangle.

      • position: Immutable<Vector3>

        The position of the rectangle. Relative to the transform set in SetTransform.

      Returns Vector2

      How big the rectangle would be, in pixels.

    • Calculates how big a rectangle on the screen with the given size would be at the given position.

      Parameters

      • screenSpaceSize: Immutable<Vector2>

        The size of the rectangle in pixels.

      • position: Immutable<Vector3>

        The position of the rectangle. Relative to the transform set in SetTransform.

      Returns Vector2

      How big the rectangle would be in world space units.