TrailRenderer component

TrailRenderer

2024.4.19

yisky

Hierarchy (view full)

Constructors

Properties

_awoken: boolean = false
_bounds: Box3 = ...
_boundsUpdateFlag: BoolUpdateFlag
_enabled: boolean = false
_object3D: Object3D<Object3DEventMap>
_onAfterRender: ((renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry<NormalBufferAttributes>, material: Material, group: Group<Object3DEventMap>) => void)
_onBeforeRender: ((renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry<NormalBufferAttributes>, material: Material, group: Group<Object3DEventMap>) => void)
_renderOrder: RenderOrder
colorGradient: Gradient = ...

Set the color gradient describing the color of the trail at various points along its length.

TrailRenderer

emitting: boolean = true

Creates trails when the GameObject moves.

TrailRenderer

endColor: Color4 = ...

Set the color at the end of the trail.

TrailRenderer

endWidth: number = 1.0

The width of the trail at the end of the trail.

TrailRenderer

entity: Entity
isRenderer: boolean = true

Renderer flag

Renderer

minVertexDistance: number = 0.1

Set the minimum distance the trail can travel before a new vertex is added to it.

TrailRenderer

queryMask: QueryMask

Query mask

Renderer

startColor: Color4 = ...

Set the color at the start of the trail.

TrailRenderer

startWidth: number = 1.0

The width of the trail at the spawning point.

TrailRenderer

textureMode: LineTextureMode = LineTextureMode.Stretch

Choose whether the U coordinate of the trail texture is tiled or stretched.

TrailRenderer

time: number = 5.0

How long does the trail take to fade out, in seconds.

TrailRenderer

userData: {
    [key: string]: any;
}

Component user data

Component

widthCurve: AnimationCurve = ...

Set the curve describing the width of the trail at various points along its length.

TrailRenderer

widthMultiplier: number = 1.0

Set an overall multiplier that is applied to the TrailRenderer.widthCurve to get the final width of the trail.

TrailRenderer

Accessors

  • get alignment(): LineAlignment
  • Select whether the trail will face the camera, or the orientation of the Transform Component.

    Returns LineAlignment

    TrailRenderer

  • set alignment(value): void
  • Select whether the trail will face the camera, or the orientation of the Transform Component.

    Parameters

    Returns void

    TrailRenderer

  • get enabled(): boolean
  • Indicates whether the component is enabled.

    Returns boolean

    Component

  • set enabled(value): void
  • Set whether the component is enabled.

    Parameters

    • value: boolean

    Returns void

    Component

  • set map(value): void
  • Set the map use to rendering the trail

    Parameters

    Returns void

    TrailRenderer

  • get material(): TrailMaterial
  • Get trail material

    Returns TrailMaterial

    TrailRenderer

  • get numCapVertices(): number
  • Set this to a value greater than 0, to get rounded corners on each end of the trail.

    Returns number

    TrailRenderer

  • set numCapVertices(value): void
  • Set this to a value greater than 0, to get rounded corners on each end of the trail.

    Parameters

    • value: number

    Returns void

    TrailRenderer

  • get numCornerVertices(): number
  • Set this to a value greater than 0, to get rounded corners between each segment of the trail.

    Returns number

    TrailRenderer

  • set numCornerVertices(value): void
  • Set this to a value greater than 0, to get rounded corners between each segment of the trail.

    Parameters

    • value: number

    Returns void

    TrailRenderer

  • get object3D(): Object3D<Object3DEventMap> | Object3D<Object3DEventMap>[]
  • Get three.js native object3D

    Returns Object3D<Object3DEventMap> | Object3D<Object3DEventMap>[]

    Renderer

  • get position(): Vector3
  • Get local position

    Returns Vector3

    Renderer

  • set position(position): void
  • Set local position

    Parameters

    • position: Vector3

    Returns void

    Renderer

  • get quaternion(): Quaternion
  • Get local quaternion

    Returns Quaternion

    Renderer

  • set quaternion(quaternion): void
  • Set local quaternion

    Parameters

    • quaternion: Quaternion

    Returns void

    Renderer

  • get renderOrder(): RenderOrder
  • Get render order

    Returns RenderOrder

    Renderer

  • set renderOrder(value): void
  • Set render order

    Parameters

    Returns void

    Renderer

  • get rotation(): Euler
  • Get local rotation

    Returns Euler

    Renderer

  • set rotation(rotation): void
  • Set local rotation

    Parameters

    • rotation: Euler

    Returns void

    Renderer

  • get scale(): Vector3
  • Get local scale

    Returns Vector3

    Renderer

  • set scale(scale): void
  • Set local scale

    Parameters

    • scale: Vector3

    Returns void

    Renderer

  • get scene(): Scene
  • Scene own the component

    Returns Scene

    Component

  • set visible(value): void
  • Set whether visible

    Parameters

    • value: boolean

    Returns void

    Renderer

  • get worldBounds(): Readonly<Box3>
  • Get renderer world bounds

    Returns Readonly<Box3>

    Renderer

Methods

  • Protected

    Attach renderer to scene

    Returns void

    Renderer

  • Protected

    Destroy

    Returns void

    TrailRenderer

  • Protected

    Detach renderer from scene

    Returns void

    Renderer

  • Protected

    Awake component callback

    Returns void

    Component

  • Protected

    Destroy callback

    Returns void

    Renderer

  • Protected

    Disable callback

    Returns void

    Renderer

  • Protected

    Enable callback

    Returns void

    Renderer

  • Protected

    Update renderer component render order

    Returns void

    Renderer

  • Protected

    Update renderer component world bounds

    Returns void

    Renderer

  • Protected

    Update renderer component world matrix

    Returns void

    Renderer

  • Before camera render

    Parameters

    • camera: Camera

      the camera use to render

    Returns void

    Renderer

  • Destroy component

    Returns void

    Component

  • Clear subscribers

    Returns void

    EventDispatcher

  • Emit event

    Parameters

    • event: {
          type: string;
          [key: string]: any;
      }
      • [key: string]: any
      • type: string

    Returns void

    EventDispatcher

  • Returns a vector representing the direction of transform's positive z-axis in world space.

    Parameters

    • target: Vector3

      The result will be copied into this Vector3.

    Returns Vector3

    Renderer

  • Returns a vector representing the position of the transforms in world space.

    Parameters

    • target: Vector3

      The result will be copied into this Vector3

    Returns Vector3

    Renderer

  • Returns a quaternion representing the rotation of the transform in world space.

    Parameters

    • target: Quaternion

      The result will be copied into this Quaternion.

    Returns Quaternion

    Renderer

  • Returns a vector of the scaling factors applied to the transform for each axis in world space.

    Parameters

    • target: Vector3

      The result will be copied into this Vector3

    Returns Vector3

    Renderer

  • Converts the vector from this object's local space to world space.

    Parameters

    • vector: Vector3

      A vector representing a position in this object's local space.

    Returns Vector3

    Renderer

  • Rotates the object to face a point in world space.

    Parameters

    • target: Vector3

      A vector representing a position in world space to look at.

    Returns void

    Renderer

  • Unsubscribe a event, if the callback param is not defined, all subscribers of this type will be removed.

    Parameters

    Returns void

    EventDispatcher

  • Subscribe a event

    Parameters

    • type: string

      event type

    • callback: SubscriberCallbackFn

      callback functions

    • Optionaloptions: {
          priority?: Priority;
          target?: any;
      } = {}

      options

      • Optionalpriority?: Priority
      • Optionaltarget?: any

    Returns void

    EventDispatcher

  • Subscribe a event, just emit once

    Parameters

    Returns void

    EventDispatcher

  • Raycast

    Parameters

    • raycaster: Raycaster

    Returns Intersection<Object3D<Object3DEventMap>>

    TrailRenderer

  • Update

    Parameters

    • timeSinceLastFrame: number
    • totalTime: number

    Returns void

    TrailRenderer

  • Converts the vector from world space to this object's local space.

    Parameters

    • vector: Vector3

      A vector representing a position in world space.

    Returns Vector3

    Renderer