ModelNode

open class ModelNode(val modelInstance: ModelInstance, autoAnimate: Boolean = true, scaleToUnits: Float? = null, centerOrigin: Position? = null) : Node

Create the ModelNode from a loaded model instance.

Use your own single MaterialLoader instance or the SceneView.materialLoader one to load your gltF form different .glTF/.glb resource locations.

See also

Constructors

Link copied to clipboard
constructor(modelInstance: ModelInstance, autoAnimate: Boolean = true, scaleToUnits: Float? = null, centerOrigin: Position? = null)

Types

Link copied to clipboard
Link copied to clipboard
interface ChildNode
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class PlayingAnimation(val startTime: Long = System.nanoTime(), val loop: Boolean = true)
Link copied to clipboard

Properties

Link copied to clipboard

The number of animation definitions in the glTF asset.

Link copied to clipboard
var animator: Animator

Retrieves the Animator for this instance.

Link copied to clipboard
val boundingBox: Box

Gets the bounding box computed from the supplied min / max values in glTF accessors.

Link copied to clipboard
Link copied to clipboard
val center: Float3
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The shape to used to detect collisions for this Node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val engine: Engine
Link copied to clipboard
Link copied to clipboard
val extents: Float3
Link copied to clipboard
val halfExtent: Float3
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Changes whether or not the renderable casts shadows.

Link copied to clipboard

Changes whether or not the renderable can receive shadows.

Link copied to clipboard

The node can be selected when a touch event happened.

Link copied to clipboard
open var isVisible: Boolean

The visible state of this node.

Link copied to clipboard
Link copied to clipboard
var materialInstances: List<List<MaterialInstance>>

Changes the material instances binding for the given primitives.

Link copied to clipboard

Returns the names of all material variants.

Link copied to clipboard
val model: FilamentAsset

The source Model (FilamentAsset) from the ModelInstance.

Link copied to clipboard

The ModelInstance to add to scene. Usually a renderable 3D model.

Link copied to clipboard
open var name: String?
Link copied to clipboard
Link copied to clipboard
var onAddedToScene: (scene: Scene) -> Unit?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onDown: (e: MotionEvent) -> Boolean?
Link copied to clipboard
var onEditingChanged: (editingTransforms: Set<KProperty1<Node, Any>?>) -> Unit?
Link copied to clipboard
var onFling: (e1: MotionEvent?, e2: MotionEvent, velocity: Float2) -> Boolean?
Link copied to clipboard
var onFrame: (frameTimeNanos: Long) -> Unit?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onRemovedFromScene: (scene: Scene) -> Unit?
Link copied to clipboard
var onRotate: (detector: RotateGestureDetector, e: MotionEvent, rotationDelta: Quaternion) -> Boolean?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onScale: (detector: ScaleGestureDetector, e: MotionEvent, scaleFactor: Float) -> Boolean?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onScroll: (e1: MotionEvent?, e2: MotionEvent, distance: Float2) -> Boolean?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onSmoothEnd: (node: Node) -> Unit?
Link copied to clipboard
var onTouch: (e: MotionEvent, hitResult: HitResult) -> Boolean?
Link copied to clipboard
open var parent: Node?

Changes the parent node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var position: Position

Position to locate within the coordinate system the parent.

Link copied to clipboard
open var quaternion: Quaternion

Quaternion rotation.

Link copied to clipboard
open var rotation: Rotation

Orientation in Euler Angles Degrees per axis from 0.0f to 360.0f.

Link copied to clipboard
open var scale: Scale

Scale on each axis.

Link copied to clipboard
val size: Float3
Link copied to clipboard

Gets the skin count of this instance.

Link copied to clipboard

Gets the skin name at skin index in this instance.

Link copied to clipboard
Link copied to clipboard

The smooth position, rotation and scale speed.

Link copied to clipboard

Local transform of the transform component (i.e. relative to the parent).

Link copied to clipboard
Link copied to clipboard
val transformManager: TransformManager
Link copied to clipboard

World-space position.

Link copied to clipboard
open var worldQuaternion: Quaternion

The world-space quaternion.

Link copied to clipboard

World-space rotation.

Link copied to clipboard
open var worldScale: Scale

World-space scale.

Link copied to clipboard

Transform from the world coordinate system to the coordinate system of this node.

Link copied to clipboard

World transform of a transform component (i.e. relative to the root).

Functions

Link copied to clipboard
fun addChildNode(node: Node): Node
Link copied to clipboard
fun addChildNodes(nodes: Set<Node>): Node
Link copied to clipboard
fun animatePositions(vararg positions: Position): ObjectAnimator
Link copied to clipboard
fun animateQuaternions(vararg quaternions: Quaternion): ObjectAnimator
Link copied to clipboard
fun animateRotations(vararg rotations: Rotation): ObjectAnimator
Link copied to clipboard
fun animateScales(vararg scales: Scale): ObjectAnimator
Link copied to clipboard
fun animateTransforms(vararg transforms: Transform): AnimatorSet
Link copied to clipboard
fun attachSkin(target: Node, @IntRange(from = 0) skinIndex: Int = 0)

Attaches the given skin to the given node, which must have an associated mesh with BONE_INDICES and BONE_WEIGHTS attributes.

Link copied to clipboard
fun centerOrigin(origin: Position = Position(x = 0.0f, y = 0.0f, z = 0.0f))

Sets up a root transform on the current model to make it centered.

Link copied to clipboard
Link copied to clipboard
open fun destroy()

Detach and destroy the node and all its children.

Link copied to clipboard
fun detachSkin(target: Node, @IntRange(from = 0) skinIndex: Int = 0)

Attaches the given skin to the given node, which must have an associated mesh with BONE_INDICES and BONE_WEIGHTS attributes.

Link copied to clipboard
open fun getJointCount(@IntRange(from = 0) skinIndex: Int = 0): Int

Gets the joint count at skin index in this instance.

Link copied to clipboard
fun getLocalPosition(worldPosition: Position): Float3

Converts a position in the world-space to a local-space of this node.

Link copied to clipboard
fun getLocalQuaternion(worldQuaternion: Quaternion): Quaternion

Converts a quaternion in the world-space to a local-space of this node.

Link copied to clipboard
fun getLocalRotation(worldRotation: Rotation): Float3

Converts a rotation in the world-space to a local-space of this node.

Link copied to clipboard
fun getLocalScale(worldScale: Scale): Float3

Converts a scale in the world-space to a local-space of this node.

Link copied to clipboard
fun getLocalTransform(worldTransform: Transform): Mat4

Converts a transform in the world-space to a local-space of this node.

fun getLocalTransform(node: Node): Mat4

Converts a node transform in the world-space to a local-space of this node.

Link copied to clipboard
open override fun getTransformationMatrix(): Matrix
Link copied to clipboard
fun getWorldPosition(localPosition: Position): Float3

Converts a position in the local-space of this node to world-space.

Link copied to clipboard
fun getWorldQuaternion(quaternion: Quaternion): Quaternion

Converts a quaternion in the local-space of this node to world-space.

Link copied to clipboard
fun getWorldRotation(rotation: Rotation): Float3

Converts a rotation in the local-space of this node to world-space.

Link copied to clipboard
fun getWorldScale(scale: Scale): Float3

Converts a scale in the local-space of this node to world-space.

Link copied to clipboard
fun getWorldTransform(localTransform: Transform): Mat4

Converts a transform in the local-space of this node to world-space.

fun getWorldTransform(node: Node): Mat4

Converts a node transform in the local-space of this node to world-space.

Link copied to clipboard
fun lookAt(targetWorldPosition: Position, upDirection: Direction = Direction(y = 1.0f), smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node

Rotates the node to face a point in world-space.

fun lookAt(targetNode: Node, upDirection: Direction = Direction(y = 1.0f), smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node

Rotates the node to face another node.

Link copied to clipboard
fun lookTowards(lookDirection: Direction, upDirection: Direction = Direction(y = 1.0f), smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node

Rotates the node to face a direction in world-space.

Link copied to clipboard
open fun onAddedToScene(scene: Scene)
Link copied to clipboard
open override fun onContextClick(e: MotionEvent): Boolean
Link copied to clipboard
open override fun onDoubleTap(e: MotionEvent): Boolean
Link copied to clipboard
open override fun onDoubleTapEvent(e: MotionEvent): Boolean
Link copied to clipboard
open override fun onDown(e: MotionEvent): Boolean
Link copied to clipboard
open override fun onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean
Link copied to clipboard
open override fun onFrame(frameTimeNanos: Long)
Link copied to clipboard
open override fun onLongPress(e: MotionEvent)
Link copied to clipboard
open override fun onMove(detector: MoveGestureDetector, e: MotionEvent): Boolean

Responds to moving events for a gesture in progress

open fun onMove(detector: MoveGestureDetector, e: MotionEvent, worldPosition: Position): Boolean
Link copied to clipboard
open override fun onMoveBegin(detector: MoveGestureDetector, e: MotionEvent): Boolean

Responds to the beginning of a moving gesture

Link copied to clipboard
open override fun onMoveEnd(detector: MoveGestureDetector, e: MotionEvent)

Responds to the end of a move gesture

Link copied to clipboard
open fun onRemovedFromScene(scene: Scene)
Link copied to clipboard
open override fun onRotate(detector: RotateGestureDetector, e: MotionEvent): Boolean

Responds to rotating events for a gesture in progress.

open fun onRotate(detector: RotateGestureDetector, e: MotionEvent, rotationDelta: Quaternion): Boolean
Link copied to clipboard
open override fun onRotateBegin(detector: RotateGestureDetector, e: MotionEvent): Boolean

Responds to the beginning of a scaling gesture.

Link copied to clipboard
open override fun onRotateEnd(detector: RotateGestureDetector, e: MotionEvent)

Responds to the end of a scale gesture.

Link copied to clipboard
open override fun onScale(detector: ScaleGestureDetector, e: MotionEvent): Boolean

Responds to scaling events for a gesture in progress.

open fun onScale(detector: ScaleGestureDetector, e: MotionEvent, scaleFactor: Float): Boolean
Link copied to clipboard
open override fun onScaleBegin(detector: ScaleGestureDetector, e: MotionEvent): Boolean

Responds to the beginning of a scaling gesture. Reported by new pointers going down.

Link copied to clipboard
open override fun onScaleEnd(detector: ScaleGestureDetector, e: MotionEvent)

Responds to the end of a scale gesture. Reported by existing pointers going up.

Link copied to clipboard
open override fun onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean
Link copied to clipboard
open override fun onShowPress(e: MotionEvent)
Link copied to clipboard
Link copied to clipboard
open override fun onSingleTapUp(e: MotionEvent): Boolean
Link copied to clipboard
open fun onTouchEvent(e: MotionEvent, hitResult: HitResult): Boolean
Link copied to clipboard

The transformation (position, rotation or scale) of the Node has changed.

Link copied to clipboard

The transformation (position, rotation or scale) of the Node has changed.

Link copied to clipboard
fun overlapTest(): Node?

Tests to see if this node collision shape overlaps the collision shape of any other nodes in the scene using Node.collisionShape.

Link copied to clipboard
fun overlapTestAll(): List<Node>

Tests to see if a node is overlapping any other nodes within the scene using Node.collisionShape.

Link copied to clipboard
fun playAnimation(animationIndex: Int, loop: Boolean = true)

Applies rotation, translation, and scale to entities that have been targeted by the given animation definition. Uses TransformManager.

fun playAnimation(animationName: String, loop: Boolean = true)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun scaleToUnitCube(units: Float = 1.0f)

Sets up a root transform on the current model to make it fit into a unit cube.

Link copied to clipboard
fun setBlendOrder(@IntRange(from = 0, to = 65535) blendOrder: Int)

Changes the drawing order for blended primitives.

Link copied to clipboard
fun setCulling(enabled: Boolean)

Changes whether or not frustum culling is on.

Link copied to clipboard

Changes whether the blend order is global or local to this Renderable (by default).

Link copied to clipboard
fun setLayerMask(@IntRange(from = 0, to = 255) select: Int, @IntRange(from = 0, to = 255) value: Int)

Changes the visibility bits.

Link copied to clipboard
fun setLayerVisible(visible: Boolean)

Changes the visibility.

Link copied to clipboard
fun setMaterialInstance(materialInstance: MaterialInstance)

Changes the material instance binding for all primitives.

Link copied to clipboard
fun setMorphWeights(weights: FloatArray, @IntRange(from = 0) offset: Int = weights.size)

Updates the vertex morphing weights on a renderable, all zeroes by default.

Link copied to clipboard
fun setPriority(@IntRange(from = 0, to = 7) priority: Int)

Changes the coarse-level draw ordering.

Link copied to clipboard
fun setScale(scale: Float)

The node scale.

Link copied to clipboard

Changes whether or not the renderable can use screen-space contact shadows.

Link copied to clipboard
fun stopAnimation(animationIndex: Int)
fun stopAnimation(animationName: String)
Link copied to clipboard
open fun transform(transform: Transform, smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node
fun transform(position: Position = this.position, rotation: Rotation, scale: Scale = this.scale, smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node
fun transform(position: Position = this.position, quaternion: Quaternion = this.quaternion, scale: Scale = this.scale, smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node

Change the node transform.

Link copied to clipboard
open fun worldTransform(worldTransform: Transform, smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node
fun worldTransform(position: Position = this.worldPosition, rotation: Rotation, scale: Scale = this.worldScale, smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node
fun worldTransform(position: Position = this.worldPosition, quaternion: Quaternion = this.worldQuaternion, scale: Scale = this.worldScale, smooth: Boolean = isSmoothTransformEnabled, smoothSpeed: Float = smoothTransformSpeed): Node

Change the node world transform.