ArcBasicDocs
3DAnimation ExtraArcBasic extension

FindAnimSeq

Sequence number of a named animation, or -1.

FindAnimSeq ( entity,name$ )

Parameters

entity
entity handle
name$
name of an animation, such as "walk" or "idle"

Description

Returns the number of the animation sequence called name$, ready to pass to Animate, or -1 if the entity has no animation of that name. Upper and lower case do not matter.

Models in .glb, .gltf and .fbx files usually hold many animations, each with a name - Kenney's characters (in the media\kenney folder) have idle, walk, sprint, jump, attacks, emotes and more. Use FindAnimSeq rather than counting sequences by hand: Animate hero,1,.5,FindAnimSeq(hero,"walk").

Names written by modelling programs as "Armature|Run" can be found as just "Run". Animations from .x and .3ds files are named after the animation set in the file, if it has one.

Example

FindAnimSeq.absOpen in editor
; Animation sequences by name (ArcBasic extensions); Space plays the next animation, Escape quitsGraphics3D 640,480SetBuffer BackBuffer()camera=CreateCamera()PositionEntity camera,0,.6,-2CameraClsColor camera,150,200,240light=CreateLight()RotateEntity light,45,30,0; a Kenney character (www.kenney.nl, CC0) with its animations built inhero=LoadAnimMesh("../../../media/kenney/mini-characters/character-knight.glb")TurnEntity hero,0,180,0; play the animation called "walk"Animate hero,1,.5,FindAnimSeq(hero,"walk")While Not KeyDown(1)	If KeyHit(57)		; step through every animation the model has		seq=(AnimSeq(hero)+1) Mod CountAnimSeqs(hero)		Animate hero,1,.5,seq,6	EndIf	UpdateWorld	RenderWorld	Text 0,0,"Animation "+AnimSeq(hero)+" of "+CountAnimSeqs(hero)+": "+AnimSeqName$(hero,AnimSeq(hero))	Text 0,15,"Space: next animation"	FlipWendEnd

See also