class Mittsu::Sprite

Constants

GEOMETRY
INDICES
UVS
VERTICES

Attributes

material[RW]
z[RW]

Public Class Methods

new(material = SpriteMaterial.new) click to toggle source
Calls superclass method Mittsu::Object3D::new
# File lib/mittsu/objects/sprite.rb, line 21
def initialize(material = SpriteMaterial.new)
  super()

  @type = 'Sprite'

  @geometry = GEOMETRY
  @material = material
  @z = nil
end

Public Instance Methods

clone(object = Sprite.new(@material)) click to toggle source
Calls superclass method Mittsu::Object3D#clone
# File lib/mittsu/objects/sprite.rb, line 48
def clone(object = Sprite.new(@material))
  super(object)
  object
end
raycast(raycaster, intersects) click to toggle source
# File lib/mittsu/objects/sprite.rb, line 31
def raycast(raycaster, intersects)
  @_matrix_position ||= Vector3.new

  @_matrix_position.set_from_matrix_position(@matrix_world)

  distance = raycaster.ray.distance_to_pint(@_matrix_position)

  return if distance > @scale.x

  intersects.push({
    distance: distance,
    point: @position,
    face: nil,
    object: self
    })
end