Sprite3D

Represents a sprite in the Kray game engine.

Constructors

Link copied to clipboard
constructor(raw: Model)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The x-component of the 3D acceleration of the Positionable3D object.

Link copied to clipboard

The y-component of the 3D acceleration of the Positionable3D object.

Link copied to clipboard

The z-component of the 3D acceleration of the Positionable3D object.

Link copied to clipboard
open override var collideable: Boolean

Whether the sprite can collide with other sprites. False means it cannot.

Link copied to clipboard

A set of all 3D sprites that are currently colliding with this sprite. Uses spatial hashing for O(n) average case complexity.

Link copied to clipboard
open override val costumes: ERROR CLASS: Unresolved name: mutableListOf

An immutable list of all costumes (models) associated with this sprite.

Link copied to clipboard

The current costume that the sprite is wearing.

Link copied to clipboard
open override var currentCostumeIndex: Int

The index of the current costume being used by this sprite.

Link copied to clipboard
open override val depth: Int

The depth of the object.

Link copied to clipboard

The friction coefficient of the Positionable object. This is used in physics calculations to determine the frictional force acting on the object. The default value is defaultFrictionCoefficient.

Link copied to clipboard
open override val height: Int

The height of the object.

Link copied to clipboard
open override var hitbox: Hitbox3D

The hitbox of the object used for collision detection.

Link copied to clipboard
open override val id: ERROR CLASS: Symbol not found for Uuid

The ID of the sprite.

Link copied to clipboard

A set of all 3D sprites that are currently inside its boundaries.

Link copied to clipboard
open override var isDrawn: Boolean

Whether the sprite has been drawn to the canvas this frame.

Link copied to clipboard

The mass multiplier of the Positionable object. This is used in physics calculations to determine the effective mass of the object. The default value is 1.0.

Link copied to clipboard
open val position: ERROR CLASS: Symbol not found for Triple<kotlin/Float, kotlin/Float, kotlin/Float>

The position of the object.

Link copied to clipboard

The restitution coefficient of the Positionable object. This is used in physics calculations to determine how bouncy the object is after collisions. The default value is defaultRestitutionCoefficient.

Link copied to clipboard

The spin factor of the Positionable object.

Link copied to clipboard
open override var static: Boolean

Whether the sprite is not affected by physics. True means it is not.

Link copied to clipboard
var Sprite3D.storedRotation: ERROR CLASS: Symbol not found for Triple<kotlin/Float, kotlin/Float, kotlin/Float>

The stored rotation of the 3D sprite as Euler angles (pitch, yaw, roll) in radians. This is the source of truth for rotation, separate from the transform matrix.

Link copied to clipboard
open val surfaceArea: Int

The surface area of the object's bounding box, based on its size parameters.

Link copied to clipboard
var Sprite3D.targetRotation: ERROR CLASS: Symbol not found for Triple<kotlin/Float, kotlin/Float, kotlin/Float>

The target rotation steps to move toward then on the ground.

Link copied to clipboard
open override var transform: Matrix4

The transformation matrix of the positionable.

Link copied to clipboard
open val volume: Int

The volume of the object's bounding box, based on its size parameters.

Link copied to clipboard

The x-component of the 3D velocity of the Positionable3D object.

Link copied to clipboard

The y-component of the 3D velocity of the Positionable3D object.

Link copied to clipboard

The z-component of the 3D velocity of the Positionable3D object.

Link copied to clipboard
open override val width: Int

The width of the object.

Link copied to clipboard
open override var x: Float

The x-coordinate of the object.

Link copied to clipboard
open override var y: Float

The x-coordinate of the object.

Link copied to clipboard
open override var z: Float

The z-coordinate of the object.

Link copied to clipboard
var zIndex: Int

The z-index of the sprite. Higher values are drawn on top of lower values.

Functions

Link copied to clipboard
open fun addCostume(costume: Model)

Adds a costume to this sprite.

Link copied to clipboard
open override fun changeTo(index: Int)

Changes the current costume of this sprite to the one at the specified index.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun isAbove(y: Float): Boolean

Returns whether the sprite is above the given Y boundary.

Link copied to clipboard
open override fun isBelow(y: Float): Boolean

Returns whether the sprite is below the given Y boundary.

Link copied to clipboard
open override fun isLeftX(x: Float): Boolean

Returns whether the sprite is left of the given X boundary.

Link copied to clipboard
open override fun isLeftZ(z: Float): Boolean

Returns whether the sprite is left of the given Z boundary.

Link copied to clipboard
open override fun isRightX(x: Float): Boolean

Returns whether the sprite is right of the given X boundary.

Link copied to clipboard
open override fun isRightZ(z: Float): Boolean

Returns whether the sprite is right of the given X boundary.

Link copied to clipboard
fun Sprite3D.lerpRotation(pitch: Float, yaw: Float, roll: Float)

Adds rotation to a 3D sprite that will be applied gradually over multiple frames.

Link copied to clipboard
open fun moveBy(deltaX: Float, deltaY: Float, deltaZ: Float)

Moves the object by the specified deltaX, deltaY, and deltaZ offsets in place.

Link copied to clipboard
open fun moveTo(newX: Float, newY: Float, newZ: Float)

Moves the object to the specified newX, newY, and newZ coordinates in place.

Link copied to clipboard
open override fun nextCostume()

Changes the current costume of this sprite to the next one in the list. Loops back to the first costume if currently at the last one.

Link copied to clipboard
open override fun previousCostume()

Changes the current costume of this sprite to the previous one in the list. Loops back to the last costume if currently at the first one.

Link copied to clipboard
open fun removeCostume(costume: Model)

Removes the specified costume from this sprite.

Link copied to clipboard
open fun removeCostumeAt(index: Int)

Removes the costume at the specified index from this sprite.

Link copied to clipboard
open fun rotate(pitch: Float, yaw: Float, roll: Float)

Rotates the transform matrix.

Link copied to clipboard
open fun scale(scale: Float)
open fun scale(sx: Float, sy: Float, sz: Float)

Scales the transform matrix.

Link copied to clipboard

Sets the x, y, and z components of the 3D acceleration of the Positionable3D object.

Link copied to clipboard
open fun setCostume(index: Int, costume: Model)

Sets the costume at the specified index for this sprite.

Link copied to clipboard
open fun setCostumes(vararg list: Model)
open fun setCostumes(list: Iterable<Model>)

Sets the costumes for this sprite.

Link copied to clipboard
open override fun setCurrentCostume(costume: Model)

Sets the current costume of this sprite to the specified image. If the image is not already a costume of this sprite, it is added.

Link copied to clipboard

Sets the x, y, and z components of the 3D velocity of the Positionable3D object.

Link copied to clipboard
open override fun switchTo(costume: Model)

Changes the current costume of this sprite to the specified image. The costume must already be part of this sprite's costumes.

Link copied to clipboard
open fun translate(x: Float, y: Float, z: Float)

Translates the transform matrix.