Mesh | CraytaKit
Skip to main content

Mesh

Functions

Function NameReturn TypeDescriptionTags
PlayAnimation(string animationName)AnimationHandlePlay a named animation on this mesh, onceNone
PlayAnimation(string animationName, boolean looping)AnimationHandlePlay a named animation on this mesh, optionally loopingNone
PlayAnimation(string animationName, boolean looping, table properties)AnimationHandlePlay a named animation on this mesh, optional table can contain named values looping, either playbackTime or playbackSpeed and either 'positionFactor' or 'positionTime' a negative playbackSpeed will play the animation in reverse. For example playbackSpeed = -2 will play the animation twice as fast in reverseNone
PlayAnimationLooping(string animationName)AnimationHandlePlay a named animation on this mesh, repeatedlyNone
PlayAnimationLooping(string animationName, table properties)AnimationHandleThis is the same as the PlayAnimation function taking a table containing playbackTime or playbackSpeed except that looping defaults to trueNone
PlayAnimationClient(string animationName)AnimationHandleUse PlayAnimation instead, works on client or serverDeprecated
PlayAnimationClient(string animationName, boolean looping)AnimationHandleUse PlayAnimation instead, works on client or serverDeprecated
PlayAnimationLoopingClient(string animationName, boolean looping)AnimationHandleUse PlayAnimation instead, works on client or serverDeprecated
GetAnimationNames()table<string>Get a table of animation names that you can play on this mesh with PlayAnimationNone
GetAnimationLength(string animationName)numberGet the length of an animation in secondsNone
CreateThruster()ThrusterAdd a thruster to an entityNone
CreateRelativeThruster()ThrusterAdd a relative thruster to an entityNone
DestroyThruster()NoneDestroy a thrusterNone
AddImpulse(Vector impulse)Add Impulse. An integral of force over a time interval. Newton secondsNone
AddAngularImpulse(Rotation angularImpulse)Add Angular Impulse. An integral of torque over a time interval. Newton secondsNone

Properties

Property NameReturn TypeDescriptionTags
collisionEnabledbooleanTurn on or off collision (ie calling entry point OnCollision)None
damageEnabledbooleanTurn on or off damage (ie calling of entry point OnDamaged)None
physicsEnabledbooleanTurn on or off physicsNone
gravityEnabledbooleanTurn on or off gravityNone
onCollisionEventCalled when this entity is collided with by a player Character with the Character passed as an argument, as well as the mesh Entity from which the onCollision event was triggered. An alternative to listening for OnCollision in a script on the entityNone
onDamageEventCalled when this entity is damaged with the amount of damage, the entity causing the damage and a HitResult structure, as well as the mesh Entity from which the onDamage event was sent. An alternative to listening for OnDamage in a script on the entityNone
meshmeshnoGet or change the meshNone
meshScaleVectorGet or change the scaleNone

Examples

PlayAnimation

he following code plays the active animation looped, starting at 50% of the way through the animation, and makes each full cycle take 1 second no matter how long the animation is. To find out what animations are available on a mesh entity hover over the "Animations" button in the property editor.

self:GetEntity():PlayAnimation("active", { looping = true, playbackTime = 1.0, positionFactor = 0.5 })
© 2024 CraytaKit