Object3D

Sprite

A sprite is a plane that always faces towards the camera, generally with a partially transparent texture applied.

Sprites do not cast shadows, setting castShadow = true will have no effect.

Example

var spriteMap = new v3d.TextureLoader().load("sprite.png"); var spriteMaterial = new v3d.SpriteMaterial({ map: spriteMap, color: 0xffffff }); var sprite = new v3d.Sprite(spriteMaterial); scene.add(sprite);

Constructor

Sprite(material : Material)

material - (optional) an instance of SpriteMaterial. Default is a white SpriteMaterial.

Creates a new Sprite.

Properties

See the base Object3D class for common properties.

.isSprite : Boolean

Used to check whether this or derived classes are sprites. Default is true.

You should not change this, as it used internally for optimisation.

.material : SpriteMaterial

An instance of SpriteMaterial, defining the object's appearance. Default is a white SpriteMaterial.

.center : Vector2

The sprite's anchor point, and the point around which the sprite rotates. A value of (0.5, 0.5) corresponds to the midpoint of the sprite. A value of (0, 0) corresponds to the lower left corner of the sprite. The default is (0.5, 0.5).

Methods

See the base Object3D class for common methods.

.clone () : Sprite

Returns a clone of this Sprite object and any descendants.

.copy (sprite : Sprite) : Sprite

Copies the properties of the passed sprite to this one.

.raycast (raycaster : Raycaster, intersects : Array) : null

Get intersections between a casted ray and this sprite. Raycaster.intersectObject will call this method.

Source

For more info on how to obtain the source code of this module see this page.