Cave Engine editor
Cave Engine project
Cave Engine scene

Cave Python API

(Based on Cave Engine v1.6.1)

A structured reference for scripting gameplay, scenes, components, assets, math, data, and engine systems in Python.

Quick Navigation

Welcome to the Cave Python API Reference. Here you will find the information you need to write Python scripts more efficiently for the engine.

If you are just getting started with Cave, we recommend following the First Steps getting started guide in the Learn quests first. If you are not familiar with Python yet, you will also find a full programming language guide in the same Learn section.

To help you navigate, the API is organized into three main categories: Main Reference, with scenes, entities, components, and the component classes used to compose entities; Miscellaneous, with engine utilities and supporting APIs; and Assets, with the asset reference for when you need direct access to those types. Use the cards below to jump through the API reference quickly.

Category

Main Reference

The objects you use most while building gameplay: scenes, entities, components, and input events.

Core

Scene structure and the base entity/component model.

Core Classes3
Class

Scene

cave.Scene

Inherits from Asset

Represents a Cave Scene.

A Scene is the runtime container where gameplay happens. It owns the entities in the current level, menu, or playable area, and provides access to scene-wide state, queries, properties, and entity creation methods.

Use cave.getScene() to access the active scene.

Enumerations1
Enumeration

CameraCameraType

"Camera" class Enumeration.

uiCanvas: UICanvasThe Canvas used by the Scene to Draw all the Game UI Elements. You probably don't want to mess with this by hand.
properties: dictA customizable Python Dict containing Scene level Properties.
paused: boolIf you set this to True, the scene will go to its paused state, not calling any Entity's update method. It will call their pausedUpdate.
allowPlay: bool
gravity: Vector3The Scene's gravity, used for Dynamic Rigid Body Physics. Note that it does NOT affect characters since they have its own independent gravity.
postProcessingOverride: str
Constructors1
def __init__(name: str = 'Scene')
Methods60
def add(e: Entity)-> Entity

Adds an existing Entity to the Scene.

def addDebugArrow(origin: Vector3,target: Vector3,color: Vector3)

Draws a Debug Arrow in the 3D Space, from the origin to the target position. This is only visible while in the Editor, meaning that it won't appear in the Game's runtime (exported project).

def addDebugBezier(p0: Vector3,p1: Vector3,p2: Vector3,p3: Vector3,color: Vector3,resolution: int = 16,directional: bool = True)
def addDebugCircle(transform: Transform,color: Vector3,numVertices: int = 8)

Draws a Debug Circle in the 3D Space. This is only visible while in the Editor, meaning that it won't appear in the Game's runtime (exported project).

def addDebugCircle(position: Vector3,radius: float,color: Vector3,numVertices: int = 8)

Draws a Debug Circle in the 3D Space. This is only visible while in the Editor, meaning that it won't appear in the Game's runtime (exported project).

def addDebugCube(transform: Transform,color: Vector3)

Draws a Debug Cube in the 3D Space. This is only visible while in the Editor, meaning that it won't appear in the Game's runtime (exported project).

def addDebugLine(origin: Vector3,target: Vector3,color: Vector3)

Draws a Debug Line in the 3D Space, from the origin to the target position. This is only visible while in the Editor, meaning that it won't appear in the Game's runtime (exported project).

def addDebugPoint(position: Vector3,color: Vector3)

Draws a Debug Point in the 3D Space. This is only visible while in the Editor, meaning that it won't appear in the Game's runtime (exported project).

def addDebugSphere(position: Vector3,radius: float,color: Vector3,numVertices: int = 8)

Draws a Debug Sphere in the 3D Space. This is only visible while in the Editor, meaning that it won't appear in the Game's runtime (exported project).

def addDefaultObjects(createTerrain: bool = False,defaultCube: bool = True)
def addFromTemplate(templateName: str,position: Vector3 = Vector3(0),rotation: Vector3 = Vector3(0),scale: Vector3 = Vector3(1))-> Entity

Creates and returns a new Entity built from the given Entity Template.

def checkContactBox(box: Transform,mask: BitMask = BitMask())-> List[CollisionInfo]

You can use this method to do Collision queries using a Box (defined by the transform you pass).

def checkContactBox(pos: Vector3,rot: Quaternion,scale: Vector3,mask: BitMask = BitMask())-> List[CollisionInfo]

You can use this method to do Collision queries using a Box (defined by the position, rotation and scale you pass).

def checkContactSphere(pos: Vector3,radius: float,mask: BitMask = BitMask())-> List[CollisionInfo]

You can use this method to do Collision queries using a Sphere (defined by the position and radius you pass).

def copyEntity(e: Entity)-> Entity

Creates a new Entity by Copying an existing one.

def generateDebugThumbnail(force: bool = False)
def get(id: int)-> Entity

Gets an Entity by its ID. Average Time Complexity is O(1), worst case is O(logN).

def get(name: str)-> Entity

Gets and Entity by its Name. Time Complexity is O(N), so avoid using this too much!

def getActiveEntity()-> Entity
def getBoundingBox()-> Transform

Returns the Approximate Bounding Box of the Entire Scene, representing everything that is Visual in it.

def getBoundingBoxPhysics()-> Transform

Returns the Approximate Bounding Box of the Entire Scene, representing the Physics Colliders.

def getCamera()-> Camera

Gets the Scene's camera instance. This is the actual camera used by the Engine to render the Scene.

def getDataOver(x: float,y: float,ignoreTemplates: bool = True)-> RayCastOut

Returns the Data over that specific position on Screen, based on the currently Rendered Data on Screen.

def getDataOverMousePosition(ignoreTemplates: bool = True)-> RayCastOut

Returns the getDataOver(...) using the Mouse Position.

def getElapsedSceneTime()-> float
def getEntities()-> List[Entity]

Returns all Entities in the Scene.

def getEntitiesFromTemplate(templateName: str)-> List[Entity]

Returns all Entities that inherits from a given Entity Template. Time Complexity is O(N).

def getEntitiesHandler()-> EntityMap
def getEntitiesWithComponent(componentName: str,searchPythonComponents: bool = False)-> List[Entity]

Returns all Entities that have the given Component. Time Complexity is O(NC) where C is the Component count. Note: this is probably very slow...

def getEntitiesWithName(name: str)-> List[Entity]

Returns all Entities with this specific Name. Time Complexity is O(N).

def getEntitiesWithProperty(prop: str)-> List[Entity]

Returns all Entities with this specific Property. Time Complexity is O(N). Note: since it uses Python to lookup this information, it may be slower than the Tags.

def getEntitiesWithTag(tag: str)-> List[Entity]

Returns all Entities with this specific Tag. Time Complexity is O(N).

def getGravity()-> Vector3
def getNumTimelinesBeingPlayed()-> int
def getPostProcessingOverride()-> str
def getProperties()-> dict
def getRenderGraphConfig()-> RenderGraph.Config
def getRootEntities()-> List[Entity]

Returns all Entities in the Scene. A Root Entity is an Entity without a Parent.

def getRootEntitiesWithProperty(prop: str)-> List[Entity]

Returns all Entities with this specific Property. Time Complexity is O(N). Note: since it uses Python to lookup this information, it may be slower than the Tags.

def getRootEntitiesWithTag(tag: str)-> List[Entity]

Returns all Entities with this specific Tag. Time Complexity is O(N).

def getSunLight()-> RenderableSun
def getSunLightPtr()-> RenderableSun
def getTimelineFrame(name: str)-> float
def getTimelineLoops(name: str)-> int
def getTimelineProgress(name: str)-> float
def incrementElapsedSceneTime()
def isAnyTimelineBeingPlayed()-> bool
def isCurrentScene()-> bool

Checks if this Scene is the active one.

def isTimelineBeingPlayed(name: str)-> bool

Checks if a specific Timeline is being played by its Asset name.

def newEntity()-> Entity

Creates a new Empty Entity.

def playTimeline(name: str,loop: bool = False,playWhenPaused: bool = False,restoreCameraOnEnd: bool = True)

Plays a specific Timeline (Cutscene) by its Asset name.

def rayCast(origin: Vector3,target: Vector3,mask: BitMask = BitMask())-> RayCastOut
def rayCastAll(origin: Vector3,target: Vector3,mask: BitMask = BitMask())-> List[RayCastOut]
def reloadTemplate(templateID: int)
def remove(e: Entity)

Queues an Entity to be removed and deleted from Scene.

def renderToTexture(cam: Camera = None,resolution: IntVector2 = IntVector2(0, 0))-> Texture
def resetElapsedSceneTime()
def setGravity(gravity: Vector3)
def setPostProcessingOverride(postProcessing: str)
def sphereCast(origin: Vector3,target: Vector3,radius: float,mask: BitMask = BitMask())-> SphereCastOut
def sphereCastAll(origin: Vector3,target: Vector3,radius: float,mask: BitMask = BitMask())-> List[SphereCastOut]
def stopAllTimelines()
def stopTimeline(name: str)
Class

Entity

cave.Entity

Inherits from Asset

Represents an Entity in a Cave Scene.

Entities are scene-owned objects used to compose your game world. They can contain components, child entities, tags, custom properties, and an active state. Do not subclass or instantiate Entity directly, instead you should create entities through Scene methods or by instantiating Entity Templates.

To get the Entity owner of the component you're creating (if any), use self.entity. To get an Entity from the scene, once you get the scene itself, use scene.get('Entity Name').

Enumerations1
Enumeration

CameraCameraType

"Camera" class Enumeration.

templateEntity: AssetHandler[EntityTemplate]If not None, this Entity inherits from an Entity Template and this was used to build it. Changing this variable alone doesn't immediatelly affect the Entity, unless you Reload it.'
tags: Tuple[str]A Set containin non Empty strings that serves as a Tag System. This is faster than Properties because it was implemented in Cave's backends without Python, so you can use this for queries when needed.'
properties: dictA customizable Python Dict containing Entity level Properties
parent: EntityThe Entity's Parent Entity or None if it's a root Entity.
Constructors1
def __init__(name: str = 'Entity',active: bool = True)
def __init__(other: Entity)
Methods52
def activate(scene: Scene)

Activates the Entity in the given Scene.

def add(c: Component)-> Component
def add(cmpName: str)-> Component
def addTag(tag: str)
def canBeAChildOf(ent: Entity)-> bool
def deactivate(scene: Scene)

Deactivates the Entity in the given Scene.

def end(scene: Scene)
def firstUpdate()
def get(literalName: str,includePython: bool = False)-> Component
def get(id: int)-> Component
def getAABB(recursive: bool = True)-> Tuple[Vector3, Vector3]
def getActive()-> bool

Same as isActive()

def getAll(literalName: str)-> List[Component]
def getBoundingBox(recursive: bool = True)-> Transform
def getChild(name: str,recursive: bool = True)-> Entity
def getChildren()-> List[Entity]
def getChildrenRecursive()-> List[Entity]
def getComponents()-> List[Component]
def getNumChildren()-> int

Returns the number of Children (not recursive) this Entity have.

def getParent()-> Entity
def getParentLevel()-> int
def getProperties()-> dict
def getPy(literalName: str)-> Component

Returns the first match in the Components list with this same given name. It will also search for the Python created Components.

def getRootParent()-> Entity
def getRootTemplate()-> Entity

Returns None if it's not templated or the Template Asset otherwise.

def getScene()-> Scene
def getTags()-> List[str]
def getTransform()-> TransformComponent

A fast (and cached) alternative to get the main Entity's Transform Component. This is better than using "get(...)" since it's cached.

def hasProperty(prop: str)-> bool
def hasTag(tag: str)-> bool
def isActive()-> bool

Returns True if the Entity is Active. It being active means that it is actually being taken into account by the Engine's Systems (such as rendering, logic, physics, etc). A disabled Entity is almost the same as an Entity that 'doesn't exist'.

def isAlive()-> bool
def isDynamic()-> bool
def isKillScheduled()-> bool

Checks to see if the Entity is scheduled to be Killed.

def isStatic()-> bool
def isTemplated(parentRecursive: bool = False)-> bool

Checks if this Entity uses a Template or not. If you set "parentRecursive" to True, it will also recursively check its parents, since an Entity that is a Child of a Templated Scene might also be considered Templated.

def kill()

Immediately adds this Entity to the killing queue, meaning that this Entity (and its children) will be completely killed and deleted by the end of the current frame. Due to how Cave works, calling this method won't immediately destroy the entity, so this internal queue is needed. You can use the method 'isAlive()' to check if the Entity is in the queue to be killed this frame or not.

def makeDynamic()
def makeStatic(recursive: bool = True)-> bool
def reload(recursive: bool = True)
def reloadTemplate(scene: Scene = None)

Reloads the current Entity's template. You can pass None if the Entity already belongs to a Scene.

def remove(cmp: Component)
def remove(literalName: str)
def removeAll(literalName: str)
def removeParent()
def removeParentLocal()
def removeTag(tag: str)
def reset(deleteChildrens: bool = True)
def scheduleKill(timeInSeconds: float)

Instead of immediately killing the Entity, you may want to schedule for the Entity to automatically kill itself after a given amount of Seconds. Use this method for it.

def setActive(value: bool,scene: Scene)

Sets the Entity's activation state, equivalent to the activate/deactivate methods and that's why it requires the activation Scene.

def setEntityUID(value: int)

Use this with CAUTION! It will brute force change the Entity ID. It may result into incorrect behaviours. This method is usually used internally.

def setParent(parent: Entity)-> bool
def setParentLocal(parent: Entity)-> bool
def start(scene: Scene)
def validateTemplate()-> bool

Checks and fixes invalid Template, returns True if the Template was valid, False if it had to be fixed.

Class

Component

cave.Component

Inherits from Asset

Base class for all Cave Components.

Custom Python components should inherit from this class. Components are attached to entities and can implement lifecycle methods such as start(), update(), lateUpdate(), pausedUpdate(), editorUpdate(), and end(). All base Component methods and variables are available to custom components.

To get a specific Component from an Entity, once youg et the entity reference, use entity.get('Name Of The Component').

Enumerations1
Enumeration

CameraCameraType

"Camera" class Enumeration.

entity: EntityStores the Entity currently owning this Component. Read only.
Constructors1
def __init__()
def __init__(other: Component)
Methods11
def editorUpdate()

This method is meant for debug only. It will be called every frame while in the editor mode, even if the game is not being played. Never gets called on standalone (exported game) mode.

def end(scene: Scene)

This is called once right after the component's owning Entity gets removed and/or deactivated from a given scene.

def firstUpdate()

Called after all the component's owning Entity other components gets their start methods called. You can use this to late initialize stuff that relies on other component's initializations. It's garanteed that it will always be called after the other component's start and before any updates.

def getCustomName()-> str
def getEntity()-> Entity

Returns the Entity currently owning this component. Same as the entity variable.

def lateUpdate()
def pausedUpdate()

Called every frame if the scene IS paused.

def reload()

Reloads the Component by calling its end() and then its start() methods. It only works if the Component's Entity already belongs to a Scene. Nothing will happen otherwise.

def setEntity(e: Entity)

Meant for internal Cave use. Changing the owning Entity by this method may cause undefined behaviour.

def start(scene: Scene)

This is called once right after the component's owning Entity gets added and/or activated to a given scene.

def update()

Called every frame if the scene IS NOT paused.

Components

Reusable gameplay, rendering, physics, audio, UI, and controller components.

Component Classes29
Class

AnimationComponent

cave.AnimationComponent

Inherits from Component

Used to animate a Mesh, given an Armature and an Animation. It supports animation blending, filtering and multiple stacked layers of concurrent animations being played and interpolated together.

Requires a valid Mesh Component in order to work properly.

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

armature: AssetHandler[Armature]
defaultAnimation: AssetHandler[Animation]
baseArmature: AssetHandler[Armature]Base Armature used for Animation Retargeting.
armatureBlock: ArmatureUBO
Constructors1
def __init__()
def __init__(other: AnimationComponent)
Methods31
def addPostEvaluationCallback(function: Any)

Adds a function pointer to be called after the Animation Component evaluates the Armature pose.

def addRagdoll(group: BitMask = BitMask(),mask: BitMask = BitMask())

Enables Ragdoll Physics for this Armature. Note: EXPERIMENTAL FEATURE! Be aware that it may not function as expected.

def clearPostEvaluationCallback()
def copyLayerFilter(filter: AnimationFilter,layer: int)-> AnimationFilter
def createLayerFilter(layer: int)-> AnimationFilter
def editorUpdate()
def end(s: Scene)
def getAABB()-> Tuple[Vector3, Vector3]
def getAnimation(layer: int = 0)-> AnimationComponent.AnimationLayer
def getAnimationName(layer: int = 0)-> str
def getBlendingProgress(layer: int = 0)-> float
def getBoundingBox()-> Transform
def getCachedMaxAABB()-> Tuple[Vector3, Vector3]
def getLayerFilter(layer: int)-> AnimationFilter
def getLayerWeight(layer: int)-> float
def getRootMotion()-> Vector3
def getRootMotionLayer(layer: int = 0)-> Vector3
def invalidateCachedAABB()
def isAnyAnimationBeingPlayed()-> bool
def isLayerBlending(layer: int = 0)-> bool
def play(anim: Animation,blend: float = 0,layer: int = 0,loop: bool = False,priority: int = 0)-> AnimationComponent.AnimationLayer
def playByName(anim: str,blend: float = 0,layer: int = 0,loop: bool = False,priority: int = 0)-> AnimationComponent.AnimationLayer
def removeLayerFilter(layer: int)
def removeRagdoll()
def requestAnimationRetargetCacheRebuild()
def setLayerWeight(layer: int,value: float)
def start(s: Scene)
def stop(layer: int = 0)
def update()
def updateRagdoll()

Read back the ragdoll position from the Physics World and applies to the Armature. This is automatically called by the engine after Evaluating the Animation Pose, so you don't need to worry about calling it by hand.

def updateSockets()
Class

AnimationSocketComponent

cave.AnimationSocketComponent

Inherits from Component

You can use this Component to copy a given Armature Bone's transform. It will attempt to copy that from its parent Entity.

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

boneName: str
position: AnimationSocketComponentCopyInfo
rotation: AnimationSocketComponentCopyInfo
scale: AnimationSocketComponentCopyInfo
Constructors1
def __init__()
def __init__(other: AnimationSocketComponent)
Class

AudioComponent

cave.AudioComponent

Inherits from Component

Simplest way to execute Static and Constant audio. Ideal for things such as Ambient sounds, etc.

Constructors1
def __init__()
def __init__(other: AudioComponent)
Methods3
def editorUpdate()
def end(scene: Scene)
def start(scene: Scene)
Class

CameraComponent

cave.CameraComponent

Inherits from Component

This Component, if enabled, will assign its current Transform and Settings to the main Scene Camera.

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

fov: float
clipStart: float
clipEnd: float
lerpPosition: float
lerpRotation: float
lerpFov: float
useCamera: bool
isPerspective: bool
updateWhenPaused: bool
flipX: bool
flipY: bool
Constructors1
def __init__()
def __init__(other: CameraComponent)
Methods7
def cameraUpdate()
def editorUpdate()
def end(s: Scene)
def pausedUpdate()
def renderToTexture(textureName: str)
def start(s: Scene)
def updateCamera(cam: Camera,applyLerp: bool = True)
Class

CharacterComponent

cave.CharacterComponent

Inherits from Component

Provides a basic but functional Character Physics behaviour for you to use.
Ideal for your Player, Enemies, NPCs and other character-like entities.

Enumerations1
Enumeration

UIElementComponentStatus

"UIElementComponent" class Enumeration.

shape: CharacterComponentShapeDesc
config: CharacterComponentConfig
gravityDirection: Vector3The direction of the Gravity. This vector is internally normalized for you before being applied. If the length is zero, it will cause the Character to have no Gravity. If you modify this after the Component initialization, remember to call updateGravity() after to apply the changes.
group: BitMask
mask: BitMask
verticalVelocity: float
fallSpeed: float
gravity: float
jumpSpeed: float
maxSlope: float
enabled: bool
Constructors1
def __init__()
def __init__(other: CharacterComponent)
Methods33
def collidedWith(tag: str)-> bool

Returns True if the Character collided with any other Entity in the Scene that contains the given tag.

def disable()
def editorUpdate()
def enable()
def end(scene: Scene)
def getCollisions()-> List[CollisionInfo]

Returns a list with all the collision between the owning Entity and others. It could contain multiple collisions between the same Entities.

def getCollisionsWith(tag: str)-> List[CollisionInfo]

Returns a list with all the collision between the owning Entity and others that contains the given tag. It could contain multiple collisions between the same Entities.

def getCurrentFallSpeed()-> float
def getEnabled()-> bool
def getFallSpeed()-> float
def getGravity()-> float
def getGravityVector()-> Vector3

Returns the gravity direction and force added together (as the length of the vector).

def getJumpSpeed()-> float
def getMaxSlope()-> float
def getMoveSpeed(ignoreDeltaTime: bool = False)-> float
def getVerticalVelocity()-> float
def getWalkDirection(ignoreDeltaTime: bool = False)-> Vector3
def isEnabled()-> bool
def isFalling()-> bool
def isMoving()-> bool
def jump()
def onGround()-> bool
def reset()
def setEnabled(value: bool)
def setFallSpeed(value: float)
def setGravity(value: float)
def setJumpSpeed(value: float)
def setMaxSlope(value: float)
def setVerticalVelocity(val: float)
def setWalkDirection(x: float,y: float,z: float,local: bool = True)
def setWalkDirection(dir: Vector3,local: bool = True)
def start(scene: Scene)
def update()
def updateGravity()

Applies any changes you made to the gravity or gravityDirection to the Character Physics itself. You don't need to call this every frame, only when you update the gravityDirection.

Class

EditorComponent

cave.EditorComponent

Inherits from Component

This is a Subclass of the Component class that is meant for you to override (Python) and create Editor Tools that are component level.

When you add an editor component, it will run like any other Components, except that it will also run while in the Editor (without the game enabled). Its editorUpdate method will also be called.
If you want to write custom Interfaces for it, override the updateInterface method. To initialize persistent variables, either use the Entity's properties OR create an __init__ method.

Constructors1
def __init__()
def __init__(other: EditorComponent)
Methods1
def updateInterface()

Called when the Component's Interface tab is being rendered (Editor). You can safely use cave.ui functions here to draw custom Interfaces.

Class

FirstPersonCamComponent

cave.FirstPersonCamComponent

Inherits from MouselookComponent

Constructors1
def __init__()
def __init__(other: FirstPersonCamComponent)
Methods1
def start(scene: Scene)
Class

LightComponent

cave.LightComponent

Inherits from Component

Provides Point Light Settings to light the scene.

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

color: Vector3
radius: float
intensity: float
spotAngle: float
spotFalloff: float
Constructors1
def __init__()
def __init__(other: LightComponent)
Methods2
def end(s: Scene)
def start(s: Scene)
Class

LogicBricksComponent

cave.LogicBricksComponent

Inherits from Component

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

properties: dict
tree: AssetHandler[LogicBricks]
Constructors1
def __init__()
def __init__(other: LogicBricksComponent)
Methods9
def callUserEvent(eventName: str,params: list = list())
def editorUpdate()
def end(scene: Scene)
def firstUpdate()
def getCustomName()-> str
def lateUpdate()
def pausedUpdate()
def start(scene: Scene)
def update()
Class

MeshComponent

cave.MeshComponent

Inherits from Component

The Mesh Component is the main renderable in the Engine.
If you want to render anything into the world, that's probably the component you want.
It takes a Mesh, a Material and a Tint Color (optional) to render.

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

visible: bool
proxyForShadowPass: MeshProxyComponent
proxyForRegularPass: MeshProxyComponent
tint: Vector4
mesh: AssetHandler[Mesh]
material: AssetHandler[Material]
allowUniformOverrides: bool
uniformOverrides: dict
Constructors1
def __init__()
def __init__(other: MeshComponent)
Methods7
def end(s: Scene)
def getBoundingBox(keepAspect: bool = True)-> Transform
def getCustomName()-> str
def getFinalMaterial()-> Material
def isAlphaBlend()-> bool
def isOpaque()-> bool
def start(s: Scene)
Class

MeshProxyComponent

cave.MeshProxyComponent

Inherits from MeshComponent

Creates a Proxy Mesh from a given set of Mesh Components (experimental).
This is meant to be used as an Optimization method for heavy scenes with a lot of small objects that can be batched together when being rendered from a distance to reduce draw calls.

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

ALL_PASSES: intEnum: MeshProxyComponentPassMask:# "MeshProxyComponent" class Enumeration.
SHADOW_PASS: int
REGULAR_PASS: int
settings: MeshProxyComponentProxyMeshSettings
Constructors1
def __init__()
def __init__(other: MeshProxyComponent)
Methods8
def bakeProxyMesh()
def editorUpdate()
def end(scene: Scene)
def exportMeshesToBakeAsObj()
def getCustomName()-> str
def lateUpdate()
def start(scene: Scene)
def updateProxies(view: Camera,passMask: MeshProxyComponent.PassMask = MeshProxyComponent.PassMask.REGULAR_PASS)
Class

MouselookComponent

cave.MouselookComponent

Inherits from Component

Provides a simple Mouselook implementation to your Entity.

Enumerations1
Enumeration

ThirdPersonCamComponentAlignPlayerRule

"ThirdPersonCamComponent" class Enumeration.

lockMousePos: bool
xAxis: MouselookAxisConfig
yAxis: MouselookAxisConfig
Constructors1
def __init__()
def __init__(other: MouselookComponent)
Methods2
def start(s: Scene)
def update()
Class

ParticleComponent

cave.ParticleComponent

Inherits from MeshComponent

Renders Particles to the Scene.

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

optimization: ParticleComponentOptimizations
instanceSetting: ParticleComponentParticleInstanceDescriptor
instanceLifeColors: ParticleComponentCurveColors
instanceSpawn: AssetHandler[Mesh]
emmiterLifetime: SceneTimer
Constructors1
def __init__()
def __init__(other: ParticleComponent)
Methods8
def editorUpdate()
def end(s: Scene)
def getCustomName()-> str
def getParticleCount()-> int
def getTints()-> List[Vector4]
def getTransforms()-> List[Transform]
def start(s: Scene)
def update()
Class

PathComponent

cave.PathComponent

Inherits from Component

A graph-based path system component that stores 3D points connected by edges (straight lines or Bezier curves). Provides navigation, pathfinding, and sampling functionality for AI, procedural generation, and gameplay mechanics.

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

showPoints: bool
showEdges: bool
pointColor: Vector3
edgeColor: Vector3
pointSize: float
bezierResolution: int
Constructors1
def __init__()
def __init__(other: PathComponent)
Methods40
def addEdge(fromPointId: UniqueID,toPointId: UniqueID)-> PathEdge
def addPoint(position: Vector3)-> PathPoint
def balanceEdgeDirections()

Reassigns edge directions in a forest to minimize multiple edges pointing toward or away from the same node.

def clear()

Deletes all Points and Edges of the Path.

def editorUpdate()
def end(scene: Scene)
def findPath(startPointId: UniqueID,endPointId: UniqueID)-> List[UniqueID]

Finds the shortest path between two points using A* pathfinding algorithm. Uses edge lengths as costs and Euclidean distance as heuristic. Returns list of point IDs.

def generateDerivativePath(outPath: PathComponent,width: float = 1)

Generates a new path by offsetting each edge of the original path to both left and right sides by the specified width, preserving connectivity at intersections where edges meet.

def generateProceduralMesh(mesh: Mesh,width: float = 0,length: float = 0)-> Mesh
def getClosestPointOnEdge(edge: PathEdge,worldPos: Vector3)-> PathQueryResult

Finds the closest point on a specific edge to a given world position. More efficient than full path search when you know the relevant edge.

def getClosestPointOnPath(worldPos: Vector3)-> PathQueryResult

Finds the closest point on the entire path to a given world position. Returns a PathQueryResult with the closest point, which edge/pathpoint it belongs to, parametric value, and distance.

def getConnectedComponents()-> List[List[UniqueID]]

Returns separate disconnected graph sections. Each component is a list of point IDs that are connected to each other but isolated from other components.

def getDirectionAtPoint(edge: PathEdge,t: float)-> Vector3

Gets the normalized direction vector at any point along an edge. Parameter t ranges from 0.0 (start) to 1.0 (end). Handles both straight lines and Bezier curves.

def getDistanceAlongPath(worldPos: Vector3)-> float

Returns the cumulative distance along the path to the closest point from a world position. Useful for tracking progress along a route.

def getEdge(fromPointId: UniqueID,toPointId: UniqueID)-> PathEdge
def getEdgeLength(edge: PathEdge)-> float

Calculates the length of a specific edge. For straight lines, returns Euclidean distance. For Bezier curves, uses numerical integration with bezierResolution subdivisions.

def getEdges()-> List[PathEdge]
def getEdgesFromPoint(pointId: UniqueID)-> List[PathEdge]
def getNormalAtPoint(edge: PathEdge,t: float)-> Vector3

Gets a normal vector perpendicular to the path direction at a specific point. Uses up vector as reference, switching to forward if path is vertical.

def getPathBounds()-> Tuple[Vector3, Vector3]

Calculates tight bounding box of the entire path in world space. Includes all points and accurately accounts for Bezier curve extents.

def getPathLength()-> float

Calculates the total length of all edges in the path. Uses caching for performance - result is cached until path structure changes.

def getPoint(pointId: UniqueID)-> PathPoint
def getPointAtDistance(startPoint: PathPoint,distance: float)-> PathQueryResult

Walks along connected edges from a start point for a specified distance. Returns the position and details of where the distance ends along the path.

def getPoints()-> List[PathPoint]
def getSampleAdvance(worldPos: Vector3,advance: float,randomGenerator: int)-> PathSample

You can use this to make the character walk the path. It walks or backward if advance is negative) along the path by the specified distance, starting from the closest point.

def getShortestPath(startPointId: UniqueID,endPointId: UniqueID,samplesPerEdge: int = 10)-> List[PathSample]

Finds the shortest path and generates detailed samples along each edge. Combines pathfinding with sampling to provide positions, directions, and distances.

def getTangentAtPoint(edge: PathEdge,t: float)-> Vector3

Gets the tangent (direction) vector at a specific point along an edge. Same as getDirectionAtPoint - provides normalized forward vector.

def getWorldBezierControlPoint(edge: PathEdge,controlPointIndex: int)-> Vector3
def getWorldPointPosition(point: PathPoint)-> Vector3
def hasEdge(fromPointId: UniqueID,toPointId: UniqueID)-> bool
def hasPoint(pointId: UniqueID)-> bool
def isPointReachable(fromPointId: UniqueID,toPointId: UniqueID)-> bool

Fast connectivity check using breadth-first search to determine if one point can reach another following edge connections and directional constraints.

def mergeByDistance(distance: float = 0.001)

Merges points that are within the specified distance of each other

def removeEdge(fromPointId: UniqueID,toPointId: UniqueID)
def removePoint(pointId: UniqueID)
def sampleEdge(edge: PathEdge,numSamples: int)-> List[PathSample]

Generates evenly spaced samples along a specific edge. Handles both straight lines and Bezier curves with accurate interpolation.

def sampleEdgeBezier(edge: PathEdge,numSamples: int,worldSpace: bool = True)-> List[Vector3]
def samplePath(numSamples: int)-> List[PathSample]

Generates evenly spaced samples along the entire path. Each sample includes position, direction, normal vector, and cumulative distance from start.

def start(scene: Scene)
def switchDirection(edge: PathEdge)
Class

PhysicsConstraintComponent

cave.PhysicsConstraintComponent

Inherits from Component

Enumerations1
Enumeration

PhysicsConstraintType

config: PhysicsConstraintComponentConstraintConfig
target: Vector3
origin: Vector3
Constructors1
def __init__()
def __init__(other: PhysicsConstraintComponent)
Methods4
def editorUpdate()
def end(s: Scene)
def start(s: Scene)
def update()
Class

PlayerComponent

cave.PlayerComponent

Inherits from Component

Provides a basic Player Controller component. Given a Character Component, moves it with W,A,S,D and jumps with Space (optionally).
If you need more control, consider writting your own controller in Python.

Enumerations1
Enumeration

ThirdPersonCamComponentAlignPlayerRule

"ThirdPersonCamComponent" class Enumeration.

active: bool
smoothTurn: float
smoothSpeed: float
walkSpeed: float
runSpeed: float
localMovement: bool
jump: bool
Constructors1
def __init__()
def __init__(other: PlayerComponent)
Methods4
def isRunning()-> bool
def isWalking()-> bool
def start(s: Scene)
def update()
Class

PythonCodeComponent

cave.PythonCodeComponent

Inherits from Component

The Python Code Component allows you to write small python code snippets for local usage.
It's similar to the PythonComponent, except that you don't have to create an entire class (it handles that for you).
The downside is that it's not as reusable as the PythonComponent.

Enumerations1
Enumeration

PythonCodeComponentOptimizationPolicy

"PythonCodeComponent" class Enumeration.

NO_OPTIMIZATION: intEnum: PythonCodeComponentOptimizationPolicy:# "PythonCodeComponent" class Enumeration.
DISTANCE_CULLING: int
FRAME_SKIPPING: int
optimization: PythonCodeComponentOptimizations
code: PythonCodeComponentPyCodes
properties: dict
Constructors1
def __init__()
def __init__(other: PythonCodeComponent)
Methods7
def compileScripts()
def editorUpdate()
def end(s: Scene)
def firstUpdate()
def pausedUpdate()
def start(s: Scene)
def update()
Class

PythonComponent

cave.PythonComponent

Inherits from Component

Main Python Component class. Allows you to create your own custom components (in Python).
Notice that this is a wrapper to your components and you should NOT inherit from this when writting them (inherit from cave.Component instead).

Constructors1
def __init__()
def __init__(other: PythonComponent)
Methods11
def editorUpdate()
def end(s: Scene)
def firstUpdate()
def getCastedPy()-> Component
def getClassName()-> str
def getCustomName()-> str
def lateUpdate()
def pausedUpdate()
def setComponent(scriptName: str,componentName: str,reload: bool = True)
def start(s: Scene)
def update()
Class

RigidBodyComponent

cave.RigidBodyComponent

Inherits from Component

General Purpose Physics Component. It can be used for Static (non movable) or Dynamic (movable) Entities.
It handles Gravity, collision detection and resolution and so on.

Enumerations1
Enumeration

RigidBodyShape

mesh: AssetHandler[Mesh]
alwaysActive: bool
enableDistanceCulling: bool
cullDistance: float
group: BitMask
mask: BitMask
gravity: Vector3Allow you to override the current Scene's gravity for this Rigid Body.
angularFactor: Vector3
shapeType: RigidBodyShape
ghost: bool
Constructors1
def __init__()
def __init__(other: RigidBodyComponent)
Methods29
def applyForce(x: float,y: float,z: float,location: Vector3)
def applyImpulse(x: float,y: float,z: float,location: Vector3)
def applyTorque(x: float,y: float,z: float)
def collidedWith(tag: str)-> bool

Returns True if the Rigid Body collided with any other Entity in the Scene that contains the given tag.

def end(s: Scene)
def getAngularFactor()-> Vector3
def getAngularVelocity()-> Vector3
def getBoxOffset()-> Vector3
def getBoxScale()-> Vector3
def getCollisions()-> List[CollisionInfo]

Returns a list with all the collision between the owning Entity and others. It could contain multiple collisions between the same Entities.

def getCollisionsWith(tag: str)-> List[CollisionInfo]

Returns a list with all the collision between the owning Entity and others that contains the given tag. It could contain multiple collisions between the same Entities.

def getCustomName()-> str
def getGhost()-> bool
def getGravity()-> Vector3
def getLinearVelocity()-> Vector3
def getShapeType()-> RigidBodyShape
def getShapeType()-> RigidBodyShape
def getTriangleMeshTriangleCount()-> int
def isBoxCollider()-> bool
def isDynamic()-> bool
def isGhost()-> bool
def setAngularFactor(value: Vector3)
def setAngularFactor(x: float,y: float,z: float)
def setAngularVelocity(x: float,y: float,z: float)
def setGhost(value: bool)
def setGravity(x: float,y: float,z: float)
def setGravity(gravity: Vector3)
def setLinearVelocity(x: float,y: float,z: float)
def setMass(mass: float)

A Static (non movable) body have ZERO mass. Any value greater than that means that the Body is Dynamic (movable). You can also use this information to toggle between static and dynamic.

def setShapeType(shape: RigidBodyShape)
def start(s: Scene)
def update()
Class

StateMachineComponent

cave.StateMachineComponent

Inherits from Component

This is meant to be used in order to properly run a State Machine (Asset) to a given Entity.

Enumerations1
Enumeration

PythonCodeComponentOptimizationPolicy

"PythonCodeComponent" class Enumeration.

properties: dict
runWhenPaused: bool
stateMachine: AssetHandler[StateMachine]
Constructors1
def __init__()
def __init__(other: StateMachineComponent)
Methods5
def end(s: Scene)
def getInstance()-> StateMachineInstance
def pausedUpdate()
def start(s: Scene)
def update()
Class

TerrainChunk

cave.TerrainChunk

Inherits from MeshComponent

Component Class used internally by the Terrain Component to render the diffent Chunks (Components) that composes the actual Terrain. You should not have to worry about this yourself.

Enumerations1
Enumeration

PythonCodeComponentOptimizationPolicy

"PythonCodeComponent" class Enumeration.

scale: Vector3
offset: Vector3
scaleUV: Vector2
offsetUV: Vector2
owner: TerrainComponent
Methods3
def getMatrix()-> Matrix4
def getTransform()-> Transform
def use(shader: ShaderProgram)
def use(shader: ShaderProgram,terrainUvScale: Vector2,stencil: Texture)
Class

TerrainComponent

cave.TerrainComponent

Inherits from Component

This Component handles Terrain Rendering and Physics based on a Height Map.

Enumerations1
Enumeration

PythonCodeComponentOptimizationPolicy

"PythonCodeComponent" class Enumeration.

height: float
lodRate: float
heightMap: AssetHandler[Texture]
materialBase: AssetHandler[Material]
materialBaseUvScale: Vector2
materialLayers: List[TerrainLayer]
gridSize: int
numComponents: int
physicsEnabled: bool
physicsGroup: BitMask
Constructors1
def __init__()
def __init__(other: TerrainComponent)
Methods7
def editorUpdate()
def end(scene: Scene)
def generateHeightMap(flatTerrain: bool = False,reload: bool = True,noiseScale: float = 8,erosionSamples: int = 10,heightScale: float = 0.34)

Creates a new Height Map texture to be used by the Component. It's done by using cave.random.terrain() function plus some erosion steps.

def getBoundingBox()-> Transform
def rayCast(origin: Vector3,target: Vector3)-> RayCastOut

Raycasts the Terrain and returns the position and normal of the hit (if any).

def start(scene: Scene)
def update()
Class

ThirdPersonCamComponent

cave.ThirdPersonCamComponent

Inherits from Component

Enumerations1
Enumeration

ThirdPersonCamComponentAlignPlayerRule

"ThirdPersonCamComponent" class Enumeration.

NEVER: intEnum: ThirdPersonCamComponentAlignPlayerRule:# "ThirdPersonCamComponent" class Enumeration.
ON_MOVEMENT: int
ALWAYS: int
mouselook: ThirdPersonCamComponentMouselook
alignPlayer: AlignPlayerRule
alignSmooth: float
headOffset: Vector3
cameraOffset: Transform
camCollision: ThirdPersonCamComponentCamCollisionConfig
Constructors1
def __init__()
def __init__(other: ThirdPersonCamComponent)
Methods6
def disableJoystick()
def editorUpdate()
def enableJoystick(id: int,tolerance: float = 0.1,sensitivity: Vector2 = Vector2(-0.1, 0.1))
def isJoystickEnabled()-> bool
def start(scene: Scene)
def update()
Class

TopDownCamComponent

cave.TopDownCamComponent

Inherits from Component

Enumerations1
Enumeration

ThirdPersonCamComponentAlignPlayerRule

"ThirdPersonCamComponent" class Enumeration.

playerName: str
height: float
distance: float
onGroundOnly: bool
forwardAdvance: float
Constructors1
def __init__()
def __init__(other: TopDownCamComponent)
Methods5
def editorUpdate()
def getExpectedCamPositionFor(playerPos: Vector3)-> Vector3
def getTargetPosition()-> Vector3
def lateUpdate()
def start(s: Scene)
Class

TransformComponent

cave.TransformComponent

Inherits from Component, NodeTransform

Transform class that contains Position, Rotation and Scaling information to a given Entity. It also handles parenting system.

Constructors1
def __init__()
def __init__(other: TransformComponent)
Methods2
def getChildren()-> List[NodeTransform]
def getParent()-> NodeTransform
Class

UIElementComponent

cave.UIElementComponent

Inherits from Component

Cave's User Interface (UI) Element. This is meant to be renderer to de screen as an UI in order to create texts, boxes, images, buttons or any other element you want.
It also handles anchoring and PARENTING for you, meaning that it will take parent UIElements into account and will affect child ones.

Enumerations1
Enumeration

UIElementComponentStatus

"UIElementComponent" class Enumeration.

NORMAL: intEnum: UIElementComponentStatus:# "UIElementComponent" class Enumeration.
HOVERED: int
PRESSED: int
position: UIVector
scale: UIVector
layer: int
scissor: boolIf enabled, it will limit the Child Elements Rendering region to this UI Element's bounding area.
quad: UIElementComponentQuadDesc
font: UIElementComponentFontDesc
text: str
defaultQuadAlpha: float
defaultQuadColor: Vector3
defaultQuadBlurBackground: float
rect: UIRect
Constructors1
def __init__()
def __init__(other: UIElementComponent)
Methods20
def end(s: Scene)
def getChildren()-> List[UIElementComponent]
def getDefaultQuadAlpha()-> float
def getDefaultQuadBlurBackground()-> float
def getDefaultQuadColor()-> Vector3
def getDrawFontScale()-> Vector2
def getParent()-> UIElementComponent
def getRect()-> UIRect
def getText()-> str
def isHovered()-> bool
def isHoveredIn()-> bool
def isHoveredOut()-> bool
def isPressed()-> bool
def isPressedIn()-> bool
def isPressedOut()-> bool
def setDefaultQuadAlpha(value: float)
def setDefaultQuadBlurBackground(value: float)
def setDefaultQuadColor(color: Vector3)
def setText(value: str)
def start(s: Scene)
Class

VehicleComponent

cave.VehicleComponent

Inherits from Component

Enumerations1
Enumeration

RigidBodyShape

engineForce: VehicleComponentEngine
steering: VehicleComponentSteering
Constructors1
def __init__()
def __init__(other: VehicleComponent)
Methods13
def accelerate(scale: float = 1)
def applyForce(force: float)
def brake(scale: float = 1)
def brakeRelease()
def end(scene: Scene)
def idle()
def reverse(scale: float = 1)
def setSteering(degreeAngle: float)

Manually sets the Wheel Steering. It will automatically e clamped by the maximum steering defined.

def start(scene: Scene)
def turnLeft()
def turnRight()
def turnStraight()

This needs to be called while the Vehicle is not steering in order to make the Wheels turn straight again.

def update()
Class

VehicleControllerComponent

cave.VehicleControllerComponent

Inherits from Component

Enumerations1
Enumeration

ThirdPersonCamComponentAlignPlayerRule

"ThirdPersonCamComponent" class Enumeration.

active: bool
Constructors1
def __init__()
def __init__(other: VehicleControllerComponent)
Methods2
def start(s: Scene)
def update()
Class

WheelComponent

cave.WheelComponent

Inherits from Component

Enumerations1
Enumeration

RigidBodyShape

tuning: WheelComponentTuningConfig
control: WheelComponentControls
dirAxis: intThis axis needs to face the Ground. Default is -Y.
axleAxis: intThis is the axis where wheel will turn around it. Default is +X.
suspensionRestLength: float
radius: float
isFrontWheel: boolOnly front wheels have Steering capabilities.
Constructors1
def __init__()

If enabled, it will be able to turn.

def __init__(other: WheelComponent)
Methods4
def editorUpdate()
def getAxle()-> Vector3
def getDirection()-> Vector3
def start(s: Scene)

Events

Event helpers plus the keyboard, mouse, and controller constants in cave.event.

Event Classes2
Class

Events

cave.Events

Methods17
def active(t: event.Type)-> bool
def active(t: str)-> bool
def forceQuit()
def getJoystick(id: int)-> Events.Joystick
def getJoystickCount()-> int
def getJoystickName(id: int)-> str
def getKeyStatus(t: event.Type)-> event.Status
def getMouseMotion()-> Vector2
def getMouseScroll()-> float
def getQuitStatus()-> bool
def getTextInput()-> str
def hasResized()-> bool
def popDroppedFiles()-> List[str]
def pressed(t: event.Type)-> bool
def pressed(t: str)-> bool
def refuseQuitStatus()
def released(t: event.Type)-> bool
def released(t: str)-> bool
def setRelativeMouse(value: bool)
def update()
Class

EventsJoystick

cave.EventsJoystick

Methods42
def active(btn: event.Controller)-> bool
def buttonActive(btn: int)-> bool
def buttonPressed(btn: int)-> bool
def buttonReleased(btn: int)-> bool
def getAccelerometer()-> Vector3
def getAxis(axis: int,tolerance: float = 0.1)-> float
def getAxisInitialState(axis: int)-> float
def getAxisLeft(tolerance: float = 0.1)-> Vector2
def getAxisRight(tolerance: float = 0.1)-> Vector2
def getBall(ball: int)-> IntVector2
def getButton(button: int)-> bool
def getControllerButton(btn: event.Controller)-> bool
def getGyroscope()-> Vector3
def getHat(hat: int)-> IntVector2
def getIndex()-> int
def getInstanceID()-> int
def getName()-> str
def getNumAxes()-> int
def getNumBalls()-> int
def getNumButtons()-> int
def getNumHats()-> int
def getNumTouchpadFingers(touchpad: int)-> int
def getNumTouchpads()-> int
def getPowerLevel()-> str
def getTouchpadFinger(touchpad: int,finger: int)-> Vector3
def getTriggerLeft()-> float
def getTriggerRight()-> float
def getType()-> str
def hasAccelerometer()-> bool
def hasAxis(axis: event.Controller)-> bool
def hasButton(axis: event.Controller)-> bool
def hasGyroscope()-> bool
def hasLED()-> bool
def hasVibration()-> bool
def isGameController()-> bool
def isValid()-> bool
def pressed(btn: event.Controller)-> bool
def released(btn: event.Controller)-> bool
def setAccelerometerEnabled(value: bool)
def setGyroscopeEnabled(value: bool)
def setLED(r: float,g: float,b: float)
def vibrate(left: float = 1,right: float = 1,duration: float = 0.5)
Namespace

cave.event

Python Stub File for the Cave Engine's EVENT API
The code here is available at cave.event. submodule
This is intended to be used with cave.getEvents()

Constants260
BUTTON_A: int

Controller (Joystick):

BUTTON_B: int
BUTTON_BACK: int
BUTTON_DPAD_DOWN: int
BUTTON_DPAD_LEFT: int
BUTTON_DPAD_RIGHT: int
BUTTON_DPAD_UP: int
BUTTON_GUIDE: int
BUTTON_LEFTSHOULDER: int
BUTTON_LEFTSTICK: int
BUTTON_MISC1: int

Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button

BUTTON_PADDLE1: int

Xbox Elite paddle P1 (upper left, facing the back)

BUTTON_PADDLE2: int

Xbox Elite paddle P3 (upper right, facing the back)

BUTTON_PADDLE3: int

Xbox Elite paddle P2 (lower left, facing the back)

BUTTON_PADDLE4: int

Xbox Elite paddle P4 (lower right, facing the back)

BUTTON_RIGHTSHOULDER: int
BUTTON_RIGHTSTICK: int
BUTTON_START: int
BUTTON_TOUCHPAD: int

PS4/PS5 touchpad button

BUTTON_X: int
BUTTON_Y: int
KEY_0: int

0

KEY_1: int

1

KEY_2: int

2

KEY_3: int

3

KEY_4: int

4

KEY_5: int

5

KEY_6: int

6

KEY_7: int

7

KEY_8: int

8

KEY_9: int

9

KEY_A: int

A

KEY_AC_BACK: int

Ac Back

KEY_AC_BOOKMARKS: int

Ac Bookmarks

KEY_AC_FORWARD: int

Ac Forward

KEY_AC_HOME: int

Ac Home

KEY_AC_REFRESH: int

Ac Refresh

KEY_AC_STOP: int

Ac Stop

KEY_AGAIN: int

Again (Redo)

KEY_ALTERASE: int

Alterase

KEY_AMPERSAND: int

Ampersand

KEY_APPLICATION: int

Application / Compose / Context Menu (Windows) Key

KEY_ASTERISK: int

Asterisk

KEY_AT: int

At

KEY_AUDIOMUTE: int

Mute Volume

KEY_AUDIONEXT: int

Next Track

KEY_AUDIOPLAY: int

Play Media

KEY_AUDIOPREV: int

Previous Track

KEY_AUDIOSTOP: int

Stop Media

KEY_B: int

B

KEY_BACKQUOTE: int

Backquote

KEY_BACKSLASH: int

Backslash

KEY_BACKSPACE: int

Backspace

KEY_BRIGHTNESSDOWN: int

Brightnessdown

KEY_BRIGHTNESSUP: int

Brightnessup

KEY_C: int

C

KEY_CALCULATOR: int

Calculator

KEY_CANCEL: int

Cancel

KEY_CAPSLOCK: int

Capslock

KEY_CARET: int

Caret

KEY_CLEAR: int

Clear

KEY_CLEARAGAIN: int

Clearagain

KEY_COLON: int

Colon

KEY_COMMA: int

Comma

KEY_COMPUTER: int

Computer

KEY_COPY: int

Copy

KEY_CRSEL: int

Crsel

KEY_CURRENCYSUBUNIT: int

Currencysubunit

KEY_CURRENCYUNIT: int

Currencyunit

KEY_CUT: int

Cut

KEY_D: int

D

KEY_DECIMALSEPARATOR: int

Decimalseparator

KEY_DELETE: int

Delete

KEY_DISPLAYSWITCH: int

Displayswitch

KEY_DOLLAR: int

Dollar

KEY_DOWN: int

Down

KEY_E: int

E

KEY_EJECT: int

Eject

KEY_END: int

End

KEY_EQUALS: int

Equals

KEY_ESCAPE: int

Escape

KEY_EXCLAIM: int

Exclaim

KEY_EXECUTE_: int

Execute

KEY_EXSEL: int

Exsel

KEY_F: int

F

KEY_F1: int

F1

KEY_F10: int

F10

KEY_F11: int

F11

KEY_F12: int

F12

KEY_F13: int

F13

KEY_F14: int

F14

KEY_F15: int

F15

KEY_F16: int

F16

KEY_F17: int

F17

KEY_F18: int

F18

KEY_F19: int

F19

KEY_F2: int

F2

KEY_F20: int

F20

KEY_F21: int

F21

KEY_F22: int

F22

KEY_F23: int

F23

KEY_F24: int

F24

KEY_F3: int

F3

KEY_F4: int

F4

KEY_F5: int

F5

KEY_F6: int

F6

KEY_F7: int

F7

KEY_F8: int

F8

KEY_F9: int

F9

KEY_FIND: int

Find

KEY_G: int

G

KEY_GREATER: int

Greater

KEY_H: int

H

KEY_HASH: int

Hash

KEY_HELP: int

Help

KEY_HOME: int

Home

KEY_I: int

I

KEY_INSERT: int

Insert

KEY_J: int

J

KEY_K: int

K

KEY_KBDILLUMDOWN: int

Kbdillumdown

KEY_KBDILLUMTOGGLE: int

Kbdillumtoggle

KEY_KBDILLUMUP: int

Kbdillumup

KEY_KP_0: int

Keypad 0

KEY_KP_00: int

Keypad 00

KEY_KP_000: int

Keypad 000

KEY_KP_1: int

Keypad 1

KEY_KP_2: int

Keypad 2

KEY_KP_3: int

Keypad 3

KEY_KP_4: int

Keypad 4

KEY_KP_5: int

Keypad 5

KEY_KP_6: int

Keypad 6

KEY_KP_7: int

Keypad 7

KEY_KP_8: int

Keypad 8

KEY_KP_9: int

Keypad 9

KEY_KP_A: int

Keypad A

KEY_KP_AMPERSAND: int

Keypad Ampersand

KEY_KP_AT: int

Keypad At

KEY_KP_B: int

Keypad B

KEY_KP_BACKSPACE: int

Keypad Backspace

KEY_KP_BINARY: int

Keypad Binary

KEY_KP_C: int

Keypad C

KEY_KP_CLEAR: int

Keypad Clear

KEY_KP_CLEARENTRY: int

Keypad Clear Entry

KEY_KP_COLON: int

Keypad Colon

KEY_KP_COMMA: int

Keypad Comma

KEY_KP_D: int

Keypad D

KEY_KP_DBLAMPERSAND: int

Keypad Dblampersand

KEY_KP_DBLVERTICALBAR: int

Keypad Dblverticalbar

KEY_KP_DECIMAL: int

Keypad Decimal

KEY_KP_DIVIDE: int

Keypad Divide

KEY_KP_E: int

Keypad E

KEY_KP_ENTER: int

Keypad Enter

KEY_KP_EQUALS: int

Keypad Equals

KEY_KP_EQUALSAS400: int

Keypad Equalsas400

KEY_KP_EXCLAM: int

Keypad Exclam

KEY_KP_F: int

Keypad F

KEY_KP_GREATER: int

Keypad Greater

KEY_KP_HASH: int

Keypad Hash

KEY_KP_HEXADECIMAL: int

Keypad Hexadecimal

KEY_KP_LEFTBRACE: int

Keypad Leftbrace

KEY_KP_LEFTPAREN: int

Keypad Leftparen

KEY_KP_LESS: int

Keypad Less

KEY_KP_MEMADD: int

Keypad Memadd

KEY_KP_MEMCLEAR: int

Keypad Memclear

KEY_KP_MEMDIVIDE: int

Keypad Memdivide

KEY_KP_MEMMULTIPLY: int

Keypad Memmultiply

KEY_KP_MEMRECALL: int

Keypad Memrecall

KEY_KP_MEMSTORE: int

Keypad Memstore

KEY_KP_MEMSUBTRACT: int

Keypad Memsubtract

KEY_KP_MINUS: int

Keypad Minus

KEY_KP_MULTIPLY: int

Keypad Multiply

KEY_KP_OCTAL: int

Keypad Octal

KEY_KP_PERCENT: int

Keypad Percent

KEY_KP_PERIOD: int

Keypad Period

KEY_KP_PLUS: int

Keypad Plus

KEY_KP_PLUSMINUS: int

Keypad Plusminus

KEY_KP_POWER: int

Keypad Power

KEY_KP_RIGHTBRACE: int

Keypad Rightbrace

KEY_KP_RIGHTPAREN: int

Keypad Rightparen

KEY_KP_SPACE: int

Keypad Space

KEY_KP_TAB: int

Keypad Tab

KEY_KP_VERTICALBAR: int

Keypad Verticalbar

KEY_KP_XOR: int

Keypad Xor

KEY_L: int

L

KEY_LALT: int

Left Alt

KEY_LCTRL: int

Left Ctrl

KEY_LEFT: int

Left

KEY_LEFTBRACKET: int

Left Bracket "{"

KEY_LEFTPAREN: int

Left Parenthesis "("

KEY_LESS: int

Less

KEY_LGUI: int

Lgui

KEY_LSHIFT: int

Left Shift

KEY_M: int

M

KEY_MAIL: int

Mail

KEY_MEDIASELECT: int

Media Select

KEY_MENU: int

Menu

KEY_MINUS: int

Minus

KEY_MODE: int

Mode

KEY_MUTE: int

Mute

KEY_N: int

N

KEY_NUMLOCKCLEAR: int

Num Lock Clear

KEY_O: int

O

KEY_OPER: int

Oper

KEY_OUT: int

Out

KEY_P: int

P

KEY_PAGEDOWN: int

Page Down

KEY_PAGEUP: int

Page Up

KEY_PASTE: int

Paste

KEY_PAUSE: int

Pause

KEY_PERCENT: int

Percent

KEY_PERIOD: int

Period

KEY_PLUS: int

Plus

KEY_POWER: int

Power

KEY_PRINTSCREEN: int

Print Screen

KEY_PRIOR: int

Prior

KEY_Q: int

Q

KEY_QUESTION: int

Question

KEY_QUOTE: int

Quote

KEY_QUOTEDBL: int

Quotedbl

KEY_R: int

R

KEY_RALT: int

Right Alt

KEY_RCTRL: int

Right Ctrl

KEY_RETURN: int

Return

KEY_RETURN2: int

Return2

KEY_RGUI: int

Rgui

KEY_RIGHT: int

Right

KEY_RIGHTBRACKET: int

Right Bracket "}"

KEY_RIGHTPAREN: int

Right Parenthesis ")"

KEY_RSHIFT: int

Right Shift

KEY_S: int

S

KEY_SCROLLLOCK: int

Scroll Lock

KEY_SELECT: int

Select

KEY_SEMICOLON: int

Semicolon

KEY_SEPARATOR: int

Separator

KEY_SIZE: int

Size

KEY_SLASH: int

Slash

KEY_SLEEP: int

Sleep

KEY_SPACE: int

Space

KEY_STOP: int

Stop

KEY_SYSREQ: int

Sysreq

KEY_T: int

T

KEY_TAB: int

Tab

KEY_THOUSANDSSEPARATOR: int

Thousands Separator

KEY_U: int

U

KEY_UNDO: int

Undo

KEY_UNKNOWN: int

Unknown

KEY_UP: int

Up

KEY_V: int

V

KEY_VOLUMEDOWN: int

Volume Down

KEY_VOLUMEUP: int

Volume Up

KEY_W: int

W

KEY_WWW: int

Www

KEY_X: int

X

KEY_Y: int

Y

KEY_Z: int

Z

MOUSE_LEFT: int

Left Mouse Button

MOUSE_MIDDLE: int

Middle Mouse Button

MOUSE_RIGHT: int

Right Mouse Button

Category

Miscellaneous

Utility APIs for math, data, random numbers, networking, Steam, file paths, windows, and editor helpers.

Engine Utils

Root cave functions, constants, and enumerations.

Enumerations6
Enumeration

AnimationInterpolation

LINEAR: intEnum: AnimationInterpolation:
CONSTANT: int
Enumeration

PhysicsConstraintType

HINGE: intEnum: PhysicsConstraintType:
SLIDER: int
CONE_TWIST: int
Enumeration

RigidBodyShape

CONVEX_HULL: intEnum: RigidBodyShape:
TRIANGLE_MESH: int
BOUNDING_BOX: int
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

SHADER_LOCATION_HEIGHTMAP: intEnum: ShaderLocations: # The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.
SHADER_LOCATION_AMBIENT_TEX: int
SHADER_LOCATION_MIST_TEX: int
SHADER_LOCATION_SKY_TEX: int
SHADER_LOCATION_MATERIALS: int
SHADER_LOCATION_TERRAIN_STENCIL: int
SHADER_LOCATION_SHADOWMAPS: int
Enumeration

ShaderProgramMacros

SHADER_SHADOW_PASS: intEnum: ShaderProgramMacros:
SHADER_ALPHA_BLEND: int
SHADER_MATERIAL_SHADELESS: int
SHADER_MATERIAL_HAS_NORMAL_MAP: int
SHADER_SCENE_SHADED: int
SHADER_SCENE_HAS_AMBIENT: int
SHADER_SCENE_HAS_MIST: int
SHADER_SCENE_HAS_SHADOWS: int
SHADER_TERRAIN: int
Enumeration

UIEntityPresets

UI_DEFAULT: intEnum: UIEntityPresets:
UI_TEXT: int
UI_BUTTON: int
UI_INPUT_SLIDER: int
UI_INPUT_NUMBER: int
UI_INPUT_TEXT: int
Functions149
def cave.addGeneratedShaders()
def cave.addMaterial(name: str,addToFiles: bool = True)-> Material

Creates a new Material Asset and adds it to the Engine's Asset Data Subsystem. Returns the newly created Material.

def cave.addMesh(name: str,addToFiles: bool = True)-> Mesh

Creates a new Mesh Asset and adds it to the Engine's Asset Data Subsystem. Returns the newly created Mesh.

def cave.addShader(path: str,source: str)
def cave.addTexture(name: str,localPath: str,addToFiles: bool = True)-> ImageTexture

Creates a new ImageTexture Asset and adds it to the Engine's Asset Data Subsystem. Returns the newly created ImageTexture.

def cave.checkInstallPath(throwException: bool = False,showWarning: bool = True)-> bool
def cave.copyToClipboard(text: str)

Given a Text, copies it to the OS Clipboard.

def cave.countFilesWithExtensionAt(path: str,extension: str)-> int
def cave.createPath(path: str)
def cave.disableMsaa()
def cave.disableSyncGPU()
def cave.displayMonitorsInfoUI()
def cave.dumpToMemory(path: str,length: int,useNewOperator: bool = True)-> int
def cave.duplicate(file: str,target: str)
def cave.enableMsaa()

Multisample Anti-Aliasing (MSAA):

def cave.enableSyncGPU()
def cave.endsWith(fullString: str,ending: str)-> bool

Returns true if the given string ends with the provided 'ending'.

def cave.endsWith(fullString: str,endings: List[str])-> bool

Returns true if the given string ends with one of the the provided 'endings' in the list.

def cave.exists(filePath: str)-> bool
def cave.findAndReplace(source: str,oldSubstr: str,newSubstr: str)-> str
def cave.findInString(source: str,filter: str,caseSensitive: bool = False)-> bool
def cave.formatBytes(bytes: int)-> str

Givem a number of bytes, formats it as a String with the appropriate (and best match) measurements: B, KiB, MiB, GiB, TiB.

def cave.formatFloat(number: float,fDigits: int = 2)-> str

Formats the given float number as a string, only keeping the specified number of digits of the fraction (and discarding the rest).

def cave.formatInteger(number: int)-> str

Formats the given integer number as a string, adding dots after each 3 characters (right to left).

def cave.formatInteger(number: int)-> str

Formats the given integer number as a string, adding dots after each 3 characters (right to left).

def cave.formatTimeNs(timeNs: int)-> str

Formats a given time in Ns to ms, only keeping two digits of the fraction.

def cave.getBaseFile()-> str
def cave.getBasePath()-> str

Returns the base Path of where the application was launched. Could be the Editor path OR the Player path depending if you're on runtime or not.

def cave.getCPUBrand()-> str
def cave.getCurrentScene()-> Scene
def cave.getCurrentStackTrackBack()-> str
def cave.getCurrentTimeInfo()-> str
def cave.getDeltaTime()-> float
def cave.getEditorDataPath(localPath: str)-> str

Returns the default path that the Cave Editor uses to serialize common stuff. Plus the localPath you provide.

def cave.getEditorPath(localPath: str)-> str

Returns the Absolute path from the Editor's location + the localPath you provide.

def cave.getEntityTemplate(name: str,markAsDirty: bool = False)-> EntityTemplate
def cave.getEvents()-> Events
def cave.getFileExtension(filePath: str)-> str
def cave.getFileFolderPath(filePath: str)-> str
def cave.getFileName(fullPath: str,skipExtension: bool = False)-> str

Given a full path, extracts the filename.

def cave.getFileName(filePath: str,withExtension: bool = True)-> str
def cave.getFilesAt(path: str)-> List[str]

Returns a list of all files at the given path (from the Asset Browser). Folders always ends with "/". It must always start at "Content/".

def cave.getFilesAt(path: str)-> List[str]
def cave.getFPS()-> int

Get the current FPS thast the game is running at

def cave.getGamePath(localPath: str)-> str

Returns the Game's current path + the localPath

def cave.getGlobalDict()-> dict

This dictionary is persistent during the entire gameplay

def cave.getInvalidFilePathChar(path: str,fullPath: bool = True)-> int

Returns the index of the first invalid character found in the path string or npos if none.

def cave.getLastWriteDate(file: str)-> str
def cave.getLastWriteTime(file: str)-> int
def cave.getLimitFPS()-> bool

If enabled, Cave will try to limit the FPS to the MaxFPS.

def cave.getMaxFPS()-> int

Get the Max FPS allowed. This won't have any effect if the FPS Limiter is disabled.

def cave.getMesh(name: str,markAsDirty: bool = False)-> Mesh
def cave.getMousePosition(normalize: bool = False)-> Vector2
def cave.getMousePositionUI()-> Vector2

This one takes the Editor UI into account and is always like the UI Elements!

def cave.getOSPath(path: str)-> str
def cave.getProgressBar()-> Tuple[int, int]
def cave.getRegexMatches(pattern: str,source: str)-> List[utils.RegexMatch]

Returns a list with all Regex matches in the source string, given the Regex pattern.

def cave.getScene()-> Scene
def cave.getScopeTime(scope: str)-> int
def cave.getScopeTimeAverage(scope: str)-> int
def cave.getScopeTraceBack()-> str
def cave.getScriptSource(scriptName: str)-> str
def cave.getShader(path: str)-> str
def cave.getStoreFrameCount()-> int
def cave.getSystemDataPath(localPath: str)-> str

Returns the default recommended OS Path that is typically used to save local user data. On Windows, its %%AppData%%, on Linux, its HOME, etc. Plus the localPath you provide.

def cave.getTexture(name: str,markAsDirty: bool = False)-> Texture
def cave.getTotalSystemRAM()-> int
def cave.getVSync()-> bool

If V-Sync is enabled, the FPS won't be higher than it.

def cave.getWindow()-> Window
def cave.getWindowSize()-> Vector2
def cave.hasEditor()-> bool

Returns True if cave is in Editor mode, False if it's a standalone game!

def cave.hideConsole()
def cave.hideProgressBar()
def cave.importDefaultAssets()

Imports all the Default Assets (the ones you see when you create a new Project, such as the Default Cube, Material, etc) into the Project.

def cave.incrementProgressBar()
def cave.incrementProgressBarWith(value: int)
def cave.isConsoleVisible()-> bool
def cave.isFolder(path: str)-> bool
def cave.isFrameCaptureActive()-> bool
def cave.isMessagesAvailable()-> bool
def cave.isMsaaEnabled()

Returns True if MSAA is enabled. Note: if MSAA is enabled but not supported, it won't work.

def cave.isMsaaSupported()

Returns True is MSAA is supported in the current machine.

def cave.isPlaying()-> bool

Returns True if the game is currently being played in the editor. It's always true on standalone.

def cave.isSyncGPUEnabled()-> bool
def cave.isValidFilePath(path: str,fullPath: bool = True)-> bool

Returns True if all characters in the 'path' string are valid characters that can be used as a System filepath. If not fullPath, it will return False if it has '\' or '/'.

def cave.join(path: str,file: str)-> str
def cave.lerpQuatConstant(start: Quaternion,end: Quaternion,amount: float)-> Quaternion
def cave.lerpQuatLinear(start: Quaternion,end: Quaternion,amount: float)-> Quaternion
def cave.lerpVec3Constant(start: Vector3,end: Vector3,amount: float)-> Vector3
def cave.lerpVec3Linear(start: Vector3,end: Vector3,amount: float)-> Vector3
def cave.makeImage(filePath: str,pixels: list[int],width: int,height: int)-> bool
def cave.message(title: str,body: str,icon: str = '',supressWhenExported: bool = False)

Allows you to outputs a given message to Cave's Editor Console but with more control over it, such as the message Title and if you want to supress it in the exported game or not. If you choose to NOT supress, it will show in the Exported game as an Info Modal (using the OS's api).

def cave.messageToApp(message: str)-> bool

Given the message, outputs it to the Cave's Editor Console. If the game is exported (so there is no Editor), it will not show anything.

def cave.minimizeConsole()
def cave.newDefaultVehicleEntity()-> Entity
def cave.newEmptyEntity()-> Entity

Helper function to create a new Empty Entity (meaning an Entity with a Transform). It does not add it to anything and it's up to you to handle it.

def cave.newEntityPopup()-> Entity

Internal Usage.

def cave.newLightEntity()-> Entity

Helper function to create a new Light Entity (meaning an Entity with a Transform + Light Component). It does not add it to anything and it's up to you to handle it.

def cave.newMeshEntity(mesh: str = 'Default Cube')-> Entity

Helper function to create a new Mesh Entity (meaning an Entity with a Transform + Mesh Component) and will set the Mesh to the one you pass as a parameter. It does not add it to anything and it's up to you to handle it.

def cave.newPathEntity()-> Entity
def cave.newScript(componentName: str)-> str

Creates a new Script (string) with the default new Script text (with the Component definition, etc) and sets the component name to the one you provide as a parameter. Returns the result as a string.

def cave.newScriptDebugTab(tabName: str)-> str

Same as the newScript, except that it will create the default DebugTab code instead of the Component one.

def cave.newUIEntity(preset: utils.UIEntityPresets,textColor: Vector4 = Vector4(1))-> Entity
def cave.notify(title: str,text: str)
def cave.open(path: str,mode: str)-> FILE
def cave.openApp(executablePath: str)-> bool

Executes a new Standalone and Independent Application given its path. This Application doesn't need to be related to Cave.

def cave.pauseFrameCapture()
def cave.playSound(name: str,volume: float = 1.0,loop: int = 0,startPaused: bool = False)-> AudioTrackInstance
def cave.quitGame()
def cave.read(file: str)-> str
def cave.reimportDefaultMeshes()

Imports again all the default Meshes.

def cave.remove(path: str)-> bool
def cave.removeAll(path: str)-> bool
def cave.removeShader(path: str)
def cave.renderSceneMockFor(entity: Entity,resolution: IntVector2)-> Texture
def cave.replaceFileExtension(filePath: str,newExtension: str)-> str
def cave.resolveMultiSampleTarget(targetTextures: List[Texture],targetDepth: Texture = None)
def cave.restartCurrentScene()
def cave.resumeFrameCapture()
def cave.revealInExplorer(path: str)
def cave.sanitizeFileName(fileName: str)-> str

Removed Special characters (that are not supported in most OS as file names) from the input fileName.

def cave.saveProfilerCapture()
def cave.selectFolder(title: str,defaultPath: str,forcePath: bool = False)-> str
def cave.setLimitFPS(value: bool)
def cave.setMaxFPS(fps: int)

Set the Max FPS allowed. This won't have any effect if the FPS Limiter is disabled.

def cave.setMousePosition(x: int,y: int)
def cave.setProgressBar(value: int,maxValue: int)
def cave.setScene(name: str)-> bool
def cave.setStoreFrameCount(value: int)
def cave.setTarget(window: Window)
def cave.setTarget(texture: Texture,depthTexture: Texture = None,multisample: bool = False)
def cave.setTarget(textures: List[Texture],depthTexture: Texture = None,multisample: bool = False)
def cave.setupNewProject(desc: NewProjectDescriptor)
def cave.setVSync(value: bool)
def cave.showConsole()
def cave.showErrorMessage(title: str,body: str)
def cave.showInfoMessage(title: str,body: str)
def cave.showMouse(show: bool)
def cave.showNewAssetMenu()-> Asset

Internal Usage.

def cave.showNewComponentPopup(popupName: str,entity: Entity = None)-> str
def cave.showNewEntityPopup(popupName: str)-> Entity

Internal Usage.

def cave.showProgressBar(title: str,maxValue: int = 100)
def cave.showQuestionMessage(title: str,body: str)-> bool
def cave.showWarningMessage(title: str,body: str)
def cave.splitLines(text: str)-> List[str]
def cave.splitPath(path: str)-> List[str]
def cave.startsWith(source: str,prefix: str)-> bool

Returns true if the given string starts with the provided 'prefix'.

def cave.syncGPU(force: bool = False)
def cave.timeToDate(time: int)-> str
def cave.toDegrees(radiansAngle: float)-> float
def cave.toRadians(degreeAngle: float)-> float
def cave.toTitleCase(variableName: str)-> str
def cave.updateProgressBar(value: int)
def cave.write(file: str,text: str)

Math

Vector, matrix, quaternion, constants, and math utility functions.

Math Classes9
Class

Matrix3

cave.Matrix3

Constructors1
def __init__()
Class

Matrix4

cave.Matrix4

Constructors1
def __init__()
Class

IntVector2

cave.IntVector2

Attributes6
s: int = 0
t: int = 0
u: int = 0
v: int = 0
x: int = 0

[x,y] or [s,t] or [u,v] are equivalents!

y: int = 0
Constructors1
def __init__()
def __init__(value: int)
def __init__(x: int,y: int)
def __init__(other: IntVector2)
Methods11
def __add__(other: IntVector2)-> IntVector2
def __eq__(other: IntVector2)-> bool
def __iadd__(other: IntVector2)-> IntVector2
def __idiv__(scalar: float)-> IntVector2
def __imul__(scalar: float)-> IntVector2
def __isub__(other: IntVector2)-> IntVector2
def __mul__(scalar: float)-> IntVector2
def __repr__()-> str
def __sub__(other: IntVector2)-> IntVector2
def __truediv__(scalar: float)-> IntVector2
def copy()-> IntVector2
Class

IntVector3

cave.IntVector3

Attributes6
b: int = 0
g: int = 0
r: int = 0
x: int = 0

[x,y,z] or [r,g,b] are equivalents!

y: int = 0
z: int = 0
Constructors1
def __init__()
def __init__(value: int)
def __init__(x: int,y: int,z: int)
def __init__(other: IntVector3)
Methods13
def __add__(other: IntVector3)-> IntVector3
def __eq__(other: IntVector3)-> bool
def __getitem__(key: int)-> int
def __iadd__(other: IntVector3)-> IntVector3
def __idiv__(scalar: float)-> IntVector3
def __imul__(scalar: float)-> IntVector3
def __isub__(other: IntVector3)-> IntVector3
def __mul__(scalar: float)-> IntVector3
def __repr__()-> str
def __setitem__(key: int,value: int)
def __sub__(other: IntVector3)-> IntVector3
def __truediv__(scalar: float)-> IntVector3
def copy()-> IntVector3
Class

IntVector4

cave.IntVector4

Attributes8
a: int = 0
b: int = 0
g: int = 0
r: int = 0
w: int = 0
x: int = 0

[x,y,z,w] or [r,g,b,a] are equivalents!

y: int = 0
z: int = 0
Constructors1
def __init__()
def __init__(value: int)
def __init__(x: int,y: int,z: int,w: int)
def __init__(other: IntVector4)
Methods4
def __getitem__(key: int)-> int
def __repr__()-> str
def __setitem__(key: int,value: int)
def copy()-> IntVector4
Class

Vector2

cave.Vector2

Attributes6
s: float = 0
t: float = 0
u: float = 0
v: float = 0
x: float = 0

[x,y] or [s,t] or [u,v] are equivalents!

y: float = 0
Constructors1
def __init__()
def __init__(value: float)
def __init__(x: float,y: float)
def __init__(other: Vector2)
Methods21
def __add__(other: Vector2)-> Vector2
def __eq__(other: Vector2)-> bool
def __getitem__(key: int)-> float
def __iadd__(other: Vector2)-> Vector2
def __idiv__(scalar: float)-> Vector2
def __imul__(scalar: float)-> Vector2
def __isub__(other: Vector2)-> Vector2
def __mul__(scalar: float)-> Vector2
def __neg__()-> Vector2
def __repr__()-> str
def __setitem__(key: int,value: float)
def __sub__(other: Vector2)-> Vector2
def __truediv__(scalar: float)-> Vector2
def copy()-> Vector2
def dot(other: Vector2)-> Vector2
def length()-> float
def lerp(other: Vector2,value: float)-> Vector2
def lerpEase(other: Vector2,value: float)-> Vector2
def normalize()
def normalized()-> Vector2
def project(intoOther: Vector2)-> Vector2
Class

Vector3

cave.Vector3

Attributes6
b: float = 0
g: float = 0
r: float = 0
x: float = 0

[x,y,z] or [r,g,b] are equivalents!

y: float = 0
z: float = 0
Constructors1
def __init__()
def __init__(value: float)
def __init__(x: float,y: float,z: float)
def __init__(other: Vector3)
Methods22
def __add__(other: Vector3)-> Vector3
def __eq__(other: Vector3)-> bool
def __getitem__(key: int)-> float
def __iadd__(other: Vector3)-> Vector3
def __idiv__(scalar: float)-> Vector3
def __imul__(scalar: float)-> Vector3
def __isub__(other: Vector3)-> Vector3
def __mul__(scalar: float)-> Vector3
def __neg__()-> Vector3
def __repr__()-> str
def __setitem__(key: int,value: float)
def __sub__(other: Vector3)-> Vector3
def __truediv__(scalar: float)-> Vector3
def copy()-> Vector3
def cross(intoOther: Vector3)-> Vector3
def dot(other: Vector3)-> Vector3
def length()-> float
def lerp(other: Vector3,value: float)-> Vector3
def lerpEase(other: Vector3,value: float)-> Vector3
def normalize()
def normalized()-> Vector3
def project(intoOther: Vector3)-> Vector3
Class

Vector4

cave.Vector4

Attributes8
a: float = 0
b: float = 0
g: float = 0
r: float = 0
w: float = 0
x: float = 0

[x,y,z,w] or [r,g,b,a] are equivalents!

y: float = 0
z: float = 0
Constructors1
def __init__()
def __init__(value: float)
def __init__(x: float,y: float,z: float,w: float)
def __init__(other: Vector4)
Methods21
def __add__(other: Vector4)-> Vector4
def __eq__(other: Vector4)-> bool
def __getitem__(key: int)-> float
def __iadd__(other: Vector4)-> Vector4
def __idiv__(scalar: float)-> Vector4
def __imul__(scalar: float)-> Vector4
def __isub__(other: Vector4)-> Vector4
def __mul__(scalar: float)-> Vector4
def __neg__()-> Vector4
def __repr__()-> str
def __setitem__(key: int,value: float)
def __sub__(other: Vector4)-> Vector4
def __truediv__(scalar: float)-> Vector4
def copy()-> Vector4
def dot(other: Vector4)-> Vector4
def length()-> float
def lerp(other: Vector4,value: float)-> Vector4
def lerpEase(other: Vector4,value: float)-> Vector4
def normalize()
def normalized()-> Vector4
def project(intoOther: Vector4)-> Vector4
Class

Quaternion

cave.Quaternion

Attributes4
w: float = 0
x: float = 0
y: float = 0
z: float = 0
Constructors1
def __init__()
def __init__(value: float)
def __init__(x: float,y: float,z: float,w: float)
def __init__(other: Quaternion)
Methods17
def __add__(other: Quaternion)-> Quaternion
def __eq__(other: Quaternion)-> bool
def __iadd__(other: Quaternion)-> Quaternion
def __imul__(scalar: float)-> Quaternion
def __isub__(other: Quaternion)-> Quaternion
def __mul__(scalar: float)-> Quaternion
def __neg__()-> Quaternion
def __repr__()-> str
def __sub__(other: Quaternion)-> Quaternion
def copy()-> Quaternion
def inversed()-> Quaternion
def length()-> float
def lerp(other: Quaternion,value: float)-> Quaternion
def lerpEase(other: Quaternion,value: float)-> Quaternion
def normalize()
def normalized()-> Quaternion
def slerp(other: Quaternion,value: float)-> Quaternion
Namespace

cave.math

Python Stub File for the Cave Engine's MATH API
The code here is available at cave.math. submodule

Constants11
BACKWARD: Vector3 = ...

Vector3( 0.0, 0.0,-1.0)

DEG2RAD: float = ...

PI / 180.0

DOWN: Vector3 = ...

Vector3( 0.0,-1.0, 0.0)

FORWARD: Vector3 = ...

Vector3( 0.0, 0.0, 1.0)

HALF_PI: float = ...

1.5707963267948966

LEFT: Vector3 = ...

Vector3( 1.0, 0.0, 0.0)

PI: float = ...

3.141592653589793

RAD2DEG: float = ...

180.0 / PI

RIGHT: Vector3 = ...

Vector3(-1.0, 0.0, 0.0)

TWO_PI: float = ...

6.283185307179586

UP: Vector3 = ...

Vector3( 0.0, 1.0, 0.0)

Functions49
def cave.math.abs(value: float)-> float
def cave.math.acos(value: float)-> float
def cave.math.asin(value: float)-> float
def cave.math.atan(value: float)-> float
def cave.math.ceil(value: float)-> float
def cave.math.clamp(x: float,minVal: float,maxVal: float)-> float
def cave.math.clampEulerAngle(angle: float,fromMin: float,fromMax)-> float

Clamps the euler angle, works with negative eulers too!

def cave.math.cos(value: float)-> float
def cave.math.distance(x: Vector2,y: Vector2)-> float
def cave.math.distance(x: Vector3,y: Vector3)-> float
def cave.math.distance(x: Vector4,y: Vector4)-> float
def cave.math.dot(x: Vector2,y: Vector2)-> float
def cave.math.dot(x: Vector3,y: Vector3)-> float
def cave.math.dot(x: Vector4,y: Vector4)-> float
def cave.math.evaluateBezier(p0: Vector3,p1: Vector3,p2: Vector3,p3: Vector3,value: float)-> Vector3

Bezier:

def cave.math.evaluateBezierDerivative(p0: Vector3,p1: Vector3,p2: Vector3,p3: Vector3,value: float)-> Vector3
def cave.math.floor(value: float)-> float
def cave.math.getBezierBounds(p0: Vector3,p1: Vector3,p2: Vector3,p3: Vector3)-> Tuple[Vector3, Vector3]
def cave.math.getBezierLength(p0: Vector3,p1: Vector3,p2: Vector3,p3: Vector3,subdivisions: float = 16)-> float
def cave.math.getClosestPointBarycentric(a: Vector3,b: Vector3,c: Vector3,pos: Vector3)-> Vector3

Same as the closestPointOnTriangle, except that it returns the Barycentric coordinates to that closest point related to the triangle instead.

def cave.math.getClosestPointOnBezier(p0: Vector3,p1: Vector3,p2: Vector3,p3: Vector3,point: Vector3)-> Tuple[float, float]

Returns t and the distance between the closest point and the given point.

def cave.math.getClosestPointOnLine(a: Vector3,b: Vector3,pos: Vector3)-> Vector3

Given a pos and a line segment (a,b), returns the closest point within this line segment to that given pos.

def cave.math.getClosestPointOnLineBarycentric(a: Vector3,b: Vector3,pos: Vector3)-> Vector2

Same as getClosestPointOnLine, except that it returns two values with how much of each point (a, b) needs to be added together to result in the closest point.

def cave.math.getClosestPointOnTriangle(a: Vector3,b: Vector3,c: Vector3,pos: Vector3)-> Vector3

Given a pos and a triangle (a,b,c), returns the closest point within this triangle to that given pos.

def cave.math.getEdgePlaneIntersection(p1: Vector3,p2: Vector3,planePos: Vector3,planeNormal: Vector3)-> Tuple[bool, Vector3]
def cave.math.getMaxVector(a: Vector3,b: Vector3)-> Vector3
def cave.math.getMinVector(a: Vector3,b: Vector3)-> Vector3
def cave.math.getTransformFromAABB(bMin: Vector3,bMax: Vector3)-> cave.Transform

AABB and Bounding Box:

def cave.math.getTrianglePlaneIntersection(a: Vector3,b: Vector3,c: Vector3,planePos: Vector3,planeNormal: Vector3)-> Vector3
def cave.math.intersectLineSphere(lineP1: Vector3,lineP2: Vector3,sphereCenter: Vector3,sphereRadius: float)-> list

Returns a list of tuples containing the intersection positions and normals!

def cave.math.intersectLineTriangle(lineP1: Vector3,lineP2: Vector3,p1: Vector3,p2: Vector3,p3: Vector3)-> (Vector3, None)
def cave.math.inverse(q: Quaternion)-> Quaternion
def cave.math.inverse(m: Matrix4)-> Matrix4
def cave.math.length(vector: Vector3)-> Vector3
def cave.math.lerp(a: float,b: float,value: float)-> float

Regular Lerpings:

def cave.math.lerp(a: Vector2,b: Vector2,value: float)-> Vector2
def cave.math.lerp(a: Vector3,b: Vector3,value: float)-> Vector3
def cave.math.lerp(a: Vector4,b: Vector4,value: float)-> Vector4
def cave.math.lerp(a: int,b: int,value: float)-> int
def cave.math.lerp(a: IntVector2,b: IntVector2,value: float)-> IntVector2
def cave.math.lerp(a: IntVector3,b: IntVector3,value: float)-> IntVector3
def cave.math.lerp(a: IntVector4,b: IntVector4,value: float)-> IntVector4
def cave.math.lerp(a: Quaternion,b: Quaternion,value: float)-> Quaternion

Quaternion Lerpings:

def cave.math.lerpEase(a: float,b: float,value: float)-> float

Ease Lerpings:

def cave.math.lerpEase(a: Vector2,b: Vector2,value: float)-> Vector2
def cave.math.lerpEase(a: Vector3,b: Vector3,value: float)-> Vector3
def cave.math.lerpEase(a: Vector4,b: Vector4,value: float)-> Vector4
def cave.math.lerpEase(a: int,b: int,value: float)-> int
def cave.math.lerpEase(a: IntVector2,b: IntVector2,value: float)-> IntVector2
def cave.math.lerpEase(a: IntVector3,b: IntVector3,value: float)-> IntVector3
def cave.math.lerpEase(a: IntVector4,b: IntVector4,value: float)-> IntVector4
def cave.math.lerpEase(a: Quaternion,b: Quaternion,value: float)-> Quaternion
def cave.math.lerpEuler(a: Vector3,b: Vector3,value: float)-> Vector3

Euler Lerpings:

def cave.math.lerpQuadric(a: float,b: float,c: float,value: float)-> float

Quadric Lerpings:

def cave.math.lerpQuadric(a: Vector2,b: Vector2,c: Vector2,value: float)-> Vector2
def cave.math.lerpQuadric(a: Vector3,b: Vector3,c: Vector3,value: float)-> Vector3
def cave.math.lerpQuadric(a: Vector4,b: Vector4,c: Vector4,value: float)-> Vector4
def cave.math.lerpQuadric(a: int,b: int,c: int,value: float)-> int
def cave.math.lerpQuadric(a: IntVector2,b: IntVector2,c: IntVector2,value: float)-> IntVector2
def cave.math.lerpQuadric(a: IntVector3,b: IntVector3,c: IntVector3,value: float)-> IntVector3
def cave.math.lerpQuadric(a: IntVector4,b: IntVector4,c: IntVector4,value: float)-> IntVector4
def cave.math.mapRange(value: float,fromMin: float,fromMax: float,toMin: float,toMax: float)-> float
def cave.math.max(x: float,y: float)-> float
def cave.math.min(x: float,y: float)-> float
def cave.math.normalized(vector: Vector3)-> Vector3

Deprecated:

def cave.math.normalizeEulerAngle(angle: float)-> float

Returns the angle in range [0, 360]

def cave.math.pow(x: float,y: float)-> float
def cave.math.project(vec: Vector2,other: Vector2)-> Vector2
def cave.math.project(vec: Vector3,other: Vector3)-> Vector3
def cave.math.project(vec: Vector4,other: Vector4)-> Vector4
def cave.math.projectDirectionOnTrianglePlane(a: Vector3,b: Vector3,c: Vector3,direction: Vector3)-> Vector3

Projects a direction vector onto the plane of the given triangle.

def cave.math.round(value: float)-> float
def cave.math.sin(value: float)-> float
def cave.math.slerp(a: Quaternion,b: Quaternion,value: float)-> Quaternion
def cave.math.sqrt(value: float)-> float
def cave.math.tan(value: float)-> float
def cave.math.toDegrees(radians: float)-> float

Converts Radians to Euler Angles (same as toEuler)

def cave.math.toEuler(radians: float)-> float

Converts Radians to Euler Angles

def cave.math.toRadians(euler: float)-> float

Converts Euler Angles to Radians

Random

Random number and choice helpers.

Namespace

cave.random

Functions9
def cave.random.choice(seq: list)-> Any

Given a list, choices a random element from it and returns it.

def cave.random.perlin(x: float)-> float
def cave.random.perlin(x: float,y: float)-> float
def cave.random.perlin(x: float,y: float,z: float)-> float
def cave.random.perlin(pos: cave.Vector2)-> float
def cave.random.perlin(pos: cave.Vector3)-> float
def cave.random.randint(a: int,b: int)-> int
def cave.random.random()-> float
def cave.random.randRange(minV: float,maxV: float)-> float
def cave.random.randRange(minV: int,maxV: int)-> int
def cave.random.randRange(minV: cave.Vector2,maxV: cave.Vector2)-> cave.Vector2
def cave.random.randRange(minV: cave.Vector3,maxV: cave.Vector3)-> cave.Vector3
def cave.random.randRange(minV: cave.Vector4,maxV: cave.Vector4)-> cave.Vector4
def cave.random.seed(newSeed: int)
def cave.random.shuffle(seq: list)

Randomly shuffles the given list, randomizing the elements order.

def cave.random.terrain(pos: cave.Vector2,octaveCount: int = 4,scaleHalves: float = 2,strengthHalves: float = 0.5,rotationDegrees: float = 30)-> float
def cave.random.uniform(a: float,b: float)-> float

Networking

Client, server, package, and peer communication APIs.

Namespace

cave.network

Classes6
Class

Client

cave.network.Client

Client class that allows you to connect to a Cave or Enet Server, sending and receiving, reliable or unreliable, messages over network.

Constructors1
def __init__(addr: str = 'localhost',port: int = 33333)

Creates the client and starts the attempt to connect to the provided Server (by the address and port).

Methods5
def isConnected()-> bool

Returns True if the Client successfully managed to connect to the provided server. A valid Client may still return False here while it is attempting to connect, since this relies on the internet connection and many other factors to successfully connect to the Server. You should handle this "waiting to Connect..." time in your Game code.

def isValid()-> bool

Returns True if the Client host is valid. If it's false, it means that there was some internal network error that caused it to fail to create the host and/or sockets.

def popPackages()-> List[network.Package]

Returns a list of all cave.network.Package received from the Server since the last time you called this method.

def send(pkg: network.Package,reliable: bool = True)

Given a Package, sends it to the server. If reliable is set to True, it will guarantee that the Package arrives to the server. If not, it will simply send it once and that's it. Please notice that, due to how internet works, reliable packages are considerably slower.

def update()

For the Client to function properly, you **MUST** call this once at the end of every frame.

Class

Package

cave.network.Package

Package class that allows you to pack regular data into a network friendly binary format by writting the data to it and/or unpack this same data by reading from it.

If you need to know more about the internal format, here is the explanation: For each data, it first writes the data type as a `char`, then the data itself. The package does not have any header or extra data other than the one you write to it.

Enumerations2
Enumeration

networkPackageDataType

"Package" class Enumeration, specifies the supported data types. This is usually handled by you automatically by the Package methods.

TYPE_INVALID: intEnum: networkPackageDataType:# "Package" class Enumeration, specifies the supported data types. This is usually handled by you automatically by the Package methods.
TYPE_INT: int
TYPE_LONG_INT: intRepresents a size_t.
TYPE_FLOAT: int
TYPE_BOOL: int
TYPE_VEC3: int
TYPE_STRING: int
Enumeration

networkPackagePackageMode

"Package" class Enumeration that specifies if the Package is set to Read or Write mode. Only the corresponding read/write methods will work.

READ: intEnables reading data back from the Package to a regular format.
WRITE: intEnables writting regular data into the Package.
Constructors1
def __init__(readMode: bool = False)

Default Package constructor. It sets the Package mode to WRITE by default, unless you pass True as a parameter (for readMode), then it will be set to READ.

def __init__(data: None,len: int)
def __init__(other: network.Package)
Methods14
def getBufferSize()-> int

Returns the size of the current Read/Write buffer of the Package.

def getNextDataType()-> network.Package.DataType

If the mode is set to READ, returns the next data type about to be read. Returns TYPE_INVALID, otherwise.

def readBool()-> bool
def readFloat()-> float
def readInt()-> int

Reads a 32 bit integer from the Package.

def readLongInt()-> int

Reads a 64 bit unsigned integer (size_t) from the Package.

def readString()-> str

Reads a regular string from the Package.

def readVector3()-> cave.Vector3
def writeBool(value: bool)
def writeFloat(value: float)
def writeInt(value: int)

Writes a 32 bit integer into the Package. Note that python integers may be higher than 32 bits and it will cause an error.

def writeLongInt(value: int)

Writes a 64 bit unsigned integer (size_t) to the Package.

def writeString(value: str)

Writes a regular string to the Package. If it's important for you to know it internally, it will write the TYPE_STRING, followed by the string length N and then N char representing the string itself.

def writeVector3(value: cave.Vector3)
Class

PackageException

cave.network.PackageException

Exception class raised by the Package class when something unexpected or wrong happens during its operations.

Attributes1
msg: str

Variable containing the Exception message.

Constructors1
def __init__(_msg: str)
Methods1
def what()-> str

Returns the Exception message. Same as the "msg" variable.

Class

Server

cave.network.Server

The main Cave's Network Server class that allows you to open a Server that Cave (or Enet) Clients can connect to, sending and receiving, reliable or unreliable, messages over network.

Constructors1
def __init__(addr: str = 'localhost',port: int = 33333)

Creates the Server and binds it to the provided address and port number. You can use "localhost" (default) address to make the Server visible to the machine currently running it only or "0.0.0.0" to make it visible to the entire network.

Methods6
def getNumClients()-> int
def getPeers()-> List[network.ServerPeer]

Returns a list of all connected cave.network.ServerPeer (Clients).

def isValid()-> bool

Returns True if this Server is valid. If False, something wrong happened when creating it and it won't function at all.

def popPackages()-> List[network.ServerPackage]

Returns a list of all cave.network.ServerPackage received from the Clients (Peers) since the last time you called this method.

def sendToAll(pkg: network.Package,reliable: bool = True)

Given a Package, sends it to ALL connected Peers (Clients). As of in all other sending methods, you can also choose if you want this to be reliable or not.

def update()

For the Server to function properly, you **MUST** call this once at the end of every frame.

Class

ServerPackage

cave.network.ServerPackage

When receiving Packages in the Server, since they can arrive from multiple different Peers, they get wrapped around this ServerPackage class to properly identify its sender (origin).

Enumerations1
Enumeration

networkPackageDataType

"Package" class Enumeration, specifies the supported data types. This is usually handled by you automatically by the Package methods.

sender: network.ServerPeerThe ServerPeer who've sent this Package.
package: network.PackageThe Package itself.
Constructors1
def __init__()
def __init__(sndr: network.ServerPeer,pkg: network.Package)
def __init__(other: network.ServerPackage)
Class

ServerPeer

cave.network.ServerPeer

When a Client connects to a Cave Server, it is considered by the server as a Peer and this is the class that handles it.

Constructors1
def __init__(peer: None = None)
def __init__(other: network.ServerPeer)
Methods4
def getAddress()-> str

Returns the Peer's Address, usually represented by its ip + port, e.g.: "123.123.1.7:33333".

def getHost()-> str

Returns the Peer's host name (IP) as a string.

def getPort()-> int

Returns the Peer's port number.

def send(pkg: network.Package,reliable: bool = True)

Sends the given Package to this Peer alone, allowing the Server to directly communicate to a single Client. If reliable is set to True, it will guarantee that the Package arrives to the server. If not, it will simply send it once and that's it. Please notice that, due to how internet works, reliable packages are considerably slower.

Steam

Steam platform integration helpers.

Namespace

cave.steam

Due to Steamworks SDK TOS, Cave can't publicly redistribute Steam APIs, so in order to use
Cave Engine's Steam Integration, make sure you first:

  • Have a valid Steamworks Account with a valid App and APPID (https://partner.steamgames.com/)
  • Have downloaded the Steamworks SDK: https://partner.steamgames.com/doc/sdk
  • Understand how the Steam API works: https://partner.steamgames.com/doc/sdk/api

After that, you will need to extract the steam_api64.dll (Windows) or libsteam_api.so (Linux)
into the same folder that Cave is located. Then Cave should be able to dinamically load the
SDK and enable the APIs bellow for you. If you don't, they will silently fail to execute.

Please read and refer to Steamworks SDK Documentation to better understand it. Cave's Integration
was built on top ot Steamworks SDK v1.6.1 and it simplifies it a bit. If you miss certain
functionality from the SDK, please contact us and explain which functionality you want and
the use case for it.

IMPORTANT (from Steam Docs):
The Steamworks API will not initialize if it does not know the App ID of your game.
When you launch your app from Steam itself then it will automatically have the App ID available.
While developing you will need to hint this to Steam with a text file. Create the a text file called
"steam_appid.txt" next to your executable containing just the App ID and nothing else.
This overrides the value that Steam provides. You should not ship this with your builds.

You can use the App ID "480" for testing purposes. Good to read:
https://partner.steamgames.com/doc/features/achievements/ach_guide

For Cave Engine, the "steam_appid.txt" should be located at the same directory as the engine, not
your project directory. This is due to how Steam API works and can't be changed.

Functions11
def cave.steam.clearAchievement(achievementID: str)-> bool
def cave.steam.getAchievementName(id: int)-> str
def cave.steam.getNumAchievements()-> int
def cave.steam.getPersonaName()-> str

Returns the current user's Steam name.

def cave.steam.hasAchievement(achievementID: str)-> bool
def cave.steam.init()-> int

Initializes Steam and setup everything for you. You MUST call this before starting to use the other interfaces. You only need to call this once, unless you shut it down.

def cave.steam.isInitialized()-> bool

Checks if the Steam API was initialized (init) and the SDK (dll/so) was loaded properly.

def cave.steam.isOverlayActive()-> bool
def cave.steam.restartAppIfNecessary(appID: int)-> bool

Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't. This is optional but highly recommended as the Steam context associated with your application (including your App ID) will not be set up if the user launches the executable directly. If you choose to use this then it should be the first Steamworks function call you make, right before cave.steam.init. If it returns true, you should consider quitting the game since Steam will already reopen it.

def cave.steam.shutdown()

When you are done using the Steamworks API you should call shutdown to release the resources used by your application internally within Steam. You should call this during process shutdown if possible, when you're about to close the game'.

def cave.steam.unlockAchievement(achievementID: str)-> bool

Data

Asset file, folder, package, and content database helpers.

Namespace

cave.data

Functions8
def cave.data.delete(path: str)-> bool

Deletes the given Asset or Folder if it exists and returns True. False on failure. Root must be Content/.

def cave.data.exists(path: str)-> bool

Checks if a file (or folder) exists. Root must be Content/.

def cave.data.getAllAssetsOfType(assetType: str)-> List[AssetFile]
def cave.data.getAsset(path: str,filename: str = '')-> AssetFile

Returns the AssetFile for that specific Asset. None if it doesn't exist or if it's a Folder. Root must be Content/.

def cave.data.getFolder(path: str)-> AssetFile

Returns the AssetFile for that specific folder. None if it doesn't exist or if it's an Asset. Root must be Content/.

def cave.data.getRoot()-> AssetFile

Returns the Root folder. All sources are inside if it. The root Path is "Content/".

def cave.data.newAsset(path: str,filename: str,assetType: str)-> AssetFile

Creates the specified Asset and returns it. Creates the Path if it doesn't exist. Returns None if that path is an Asset or invalid. Root must be Content/.

def cave.data.newFolder(path: str)-> AssetFile

Creates the specified Folder and returns it. Works recursively (if none of the folders exist), also works if the folder path already exists. Returns None if that path is an Asset. Root must be Content/.

Classes4
Class

AssetData

cave.data.AssetData

Attributes1
mainScene: AssetHandler[Scene]
Constructors1
def __init__()
Methods13
def clear(freeMemory: bool = False)
def get(assetId: int)-> Asset
def getAssetCount()-> int
def getAssetMap(classId: int,createIfNone: bool = True)-> AssetMap
def getAssetMaps()-> List[AssetMap]
def getFileAt(path: str,createIfNone: bool = True)-> AssetFile
def getRootFile()-> AssetFile
def getSelectedFile(rootIfNone: bool = True,attemptToRecover: bool = True)-> AssetFile
def importRawAsset(absPath: str,skipAdvanced: bool = False)-> bool
def merge(data: AssetData,replaceDuplis: bool = False)
def resetFileSystem()
def scanAssets()
def setSelectedFile(file: AssetFile,markForRecovery: bool = True)
Class

AssetFile

cave.data.AssetFile

Inherits from Asset

In Cave, every Asset from the Asset Data, in order to appear in the Asset Browser, have an 1-1 connection to an AssetFile (you can access it from the Asset's debug.handler property).

The AssetFile may not be connected to any Asset as well. In this case, it will be considered a Folder and could have Child Asset Files. Everything you see in the Asset Browser is just Asset Files, including the Assets itself. In this case, the Asset Files are mapped to the actual Assets, as explained.

Asset Files can be Exported as a Cave Package, hence why you'll see the Package Descriptor API near by.

Attributes2
name: str
selected: bool
Constructors1
def __init__(name: str = 'Folder')
def __init__(asset: Asset)
def __init__(other: AssetFile)
Methods29
def addChild(child: AssetFile)-> bool
def addChildAsset(asset: Asset)-> bool
def agroupChildren()

It will organize all the children into folders by type.

def canBeAChildOf(parent: AssetFile)-> bool
def dissolveFolder()-> bool

Will move all the folder content to its parent. Does nothing if this is not a folder or don't have a parent. Returns True on success.

def exportPackage(file: File,desc: CavePackageDescriptor = None,all: bool = True)

Exports the asset (recursively, if it's a folder) into a standalone Cave Package that can be later imported into another project. If the 'all' parameter is True, it will also save the asset datas itself.

def getAsset()-> Asset

Use this to get the actual Asset class instance that this AssetFile represents (if it's an Asset). If it's a Folder, it will return None.

def getChild(name: str)-> AssetFile
def getChildFolder(name: str)-> AssetFile
def getChildRecursive(childID: int)-> AssetFile
def getChildren()-> List[AssetFile]
def getChildrenRecursive()-> List[AssetFile]
def getName()-> str
def getParent()-> AssetFile
def getPath()-> str
def getTypeName()-> str
def getUniqueAssetFileID()-> int
def getUniqueAssetFileName()-> str
def importPackage(file: File,desc: CavePackageDescriptor = None,all: bool = True)
def isAsset()-> bool

Returns True if this Asset File is mapped to an actual Asset.

def isDirty()-> bool

Returns True if the corresponding Asset (or Folder) needs to be Serialized (Saved).

def isFolder()-> bool

Returns True if this Asset File is a folder (meaning that it could have Child Asset Files and that it is not mapped to an actual Asset).

def isOrphan()-> bool

An Orphan AssetFile is a corrupted file that was meant to be an Asset, but lost its references. This is not supposed to happen and if it does, it probably means that your project files got messed up.

def markAsDirty()
def markAsNotDirty()
def removeChild(child: AssetFile)-> bool
def removeEmptyFolders()
def setName(value: str)
def sortChildren()

It will sort the children by name, then by type.

Class

AssetMap

cave.data.AssetMap

Constructors1
def __init__(classID: int,ownerData: AssetData)
Methods12
def add(data: Asset,replaceDuplis: bool = False)-> bool
def addCopyFromUI(source: Asset)-> Asset
def addNewFromUI()-> Asset
def clear(freeMemory: bool = False)
def get(name: str,searchChildren: bool = False)-> Asset
def get(id: int,searchChildren: bool = False)-> Asset
def getAll(includeChildren: bool = True)-> List[Asset]
def getAll(name: str,includeChildren: bool = True)-> List[Asset]
def getAssetCount()-> int
def getIDs()-> List[int]
def getMapClassID()-> int
def getNames(includeId: bool = False)-> List[str]
def merge(other: AssetMap,replaceDuplis: bool = False)
def remove(name: str,freeMemory: bool = True)-> bool
def remove(id: int,freeMemory: bool = True)-> bool
Class

CavePackageDescriptor

cave.data.CavePackageDescriptor

As the name suggests, its a Descriptor class used by Cave to store Cave Package specific information, meant to be used when exporting/importing a Package. Internal Use.

Attributes6
author: str

Who made the Package.

date: str

Creation/Export date of the Package.

description: str

Description of the Package.

name: str

The Package name.

thumbnail: AssetHandler[Texture]

An Asset Handler for a Texture to be used as the Package Thumbnail. Note: This will not be saved/loaded as a regular Handler!

thumbTexture: ImageTexture

A direct pointer to the loaded Thumbnail Texture. This will not be serialized and not freed! (up to you), it's here to store the thumbnail when package is loaded.

Constructors1
def __init__()
Category

Assets

Asset classes and the remaining lower-level types used by Cave Engine systems.

Main Assets

The primary asset types used directly in Cave projects.

Main Asset Classes12
Class

EntityTemplate

cave.EntityTemplate

Inherits from Asset

Constructors1
def __init__()
def __init__(entity: Entity)
Methods2
def getBase()-> Entity
def setBase(entity: Entity)
Class

PythonScript

cave.PythonScript

Inherits from Asset

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

code: str
Constructors1
def __init__()
Methods10
def compile()
def compileAndRun(locals: PyObject = None)
def generateDebugThumbnail(force: bool = False)
def getCode()-> str
def getInspection()-> List[PyClass]
def isCompiled()-> bool
def run(locals: PyObject = None)
def setCode(code: str)
def syncAllOverrides(className: str,overrides: dict)
def uIDoubleClicked()
Class

StateMachine

cave.StateMachine

Inherits from Asset

Allows you to create Hierarchical State Machines (HSM) for custom game logics to your Entity. Ideal for NPCs, AI agents, etc. Use this in combination with Components to get the best out of the System.

Enumerations1
Enumeration

SourceCodeSourceType

"SourceCode" class Enumeration.

properties: dict
Constructors1
def __init__()
Methods5
def generateDebugThumbnail(force: bool = False)
def getAllStates()-> Tuple[StateMachine.State]
def getRoot()-> StateMachine.State
def getState(id: UniqueID)-> StateMachine.State
def getStateChain(id: UniqueID)-> List[StateMachine.State]
Class

Texture

cave.Texture

Inherits from Asset

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

data: List[int]
Constructors1
def __init__()
def __init__(other: Texture)
Methods14
def drawUIThumbnail(displayInfo: bool = True,hoverText: str = 'Preview')-> bool
def getAspect()-> float
def getHeight()-> int
def getResolution()-> IntVector2
def getTextureID()-> int
def getWidth()-> int
def isGammaSpace()-> bool
def readPixelFloat(x: float,y: float)-> Vector4
def readPixelFloatAbsolute(x: int,y: int)-> Vector4
def readPixels()-> List[int]
def saveAsPNG(filePath: str,flipVertical: bool = True)
def setPixels(pixels: List[int])
def setResolution(width: int,height: int)
def submitTexture()
Class

Material

cave.Material

Inherits from Asset

Material class is used to define the visuals for any given Mesh.
It allows you to specify custom colors, textures, settings and Shaders to render the Meshes.

Enumerations1
Enumeration

AnimationInterpolation

mask: BitMask
shadeless: bool
alphaBlend: bool
backfaceCulling: bool
shaderOverride: AssetHandler[ShaderProgram]
uniforms: ShaderUniforms
Constructors1
def __init__(name: str = 'Basic Material')
def __init__(other: Material)
Methods8
def generateDebugThumbnail(force: bool = False)
def getCopy()-> Material
def isAlphaBlend()-> bool
def isOpaque()-> bool
def uIDoubleClicked()
def updateShaderPermutations()-> int
def updateUniforms()
def use(_shader: ShaderProgram,shadowPass: bool = False)
Class

ShaderProgram

cave.ShaderProgram

Inherits from Asset

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

uniforms: ShaderUniforms
vertex: SourceCode
geometry: SourceCode
fragment: SourceCode
Constructors1
def __init__()
def __init__(vert: str,frag: str,name: str = 'Shader')
def __init__(vert: str,geom: str,frag: str,name: str)
def __init__(other: ShaderProgram)
Methods8
def generateDebugThumbnail(force: bool = False)
def getUniformComment(uniformName: str)-> str
def isValid()-> bool
def reload()
def set(name: str,value: int)
def set(name: str,value: int)
def set(name: str,value: bool)
def set(name: str,value: float)
def set(name: str,value: Vector2)
def set(name: str,value: IntVector2)
def set(name: str,value: Vector3)
def set(name: str,value: IntVector3)
def set(name: str,value: Vector4)
def set(name: str,value: IntVector4)
def set(name: str,value: Matrix3)
def set(name: str,value: Matrix4)
def set(name: str,tex: rhi.ITexture)
def setUniformBuffer(name: str,bindingPoint: int)
def uIThumbnailDrawn(pos: Vector2,size: Vector2)
def use(permutation: int = 0)
Class

UIStyle

cave.UIStyle

Inherits from Asset

Enumerations1
Enumeration

AnimationInterpolation

nineSliceUse: bool
nineSliceBorder: float
colorBase: UIStyleColor
colorHovered: UIStyleColor
colorPressed: UIStyleColor
onHoverIn: SourceCode
onHoverOut: SourceCode
onClickIn: SourceCode
onClickOut: SourceCode
Constructors1
def __init__()
def __init__(other: UIStyle)
Methods2
def uIDoubleClicked()
def uIThumbnailDrawn(pos: Vector2,size: Vector2)
Class

PostProcessing

cave.PostProcessing

Inherits from Asset

Enumerations1
Enumeration

MeshShadowPassRule

"Mesh" class Enumeration to specify the Rendering behaviour during the Shadow Pass.

passes: List[Filter]
Constructors1
def __init__()
Methods3
def generateDebugThumbnail(force: bool = False)
def uIDoubleClicked()
def uIThumbnailDrawn(pos: Vector2,size: Vector2)
Class

Timeline

cave.Timeline

Inherits from Asset

The Timeline is meant for you to Design Cutscenes and/or Scripted Events. Keyframe Entity Transforms and Components, play Animations, trigger Scripts, and even run multiple Timelines together.

In order to play a timeline, get the current scene and call scene.playTimeline('Timeline Name').

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

BLEND_NONE: intEnum: TimelineChannelBlend:# "Timeline" class Enumeration.
BLEND_LINEAR: int
BLEND_EASE: int
BLEND_QUADRIC: int
cameras: SortedFrames[Tuple[int, int]]
cameraNames: Dict[int, str]
callbacks: SortedFrames[SourceCode]
audioTracks: List[SortedFrames[AudioInstance]]
entities: List[Timeline.EntityChannel]
cursor: float
frameStart: float
frameEnd: float
Constructors1
def __init__()
Methods10
def applyActiveCamera(scene: Scene,frame: float,owner: Entity = None)
def applyActivityToEntities(scene: Scene,frame: float,owner: Entity = None)
def applyAutoKeyframe(scene: Scene,frame: float,owner: Entity = None)
def applyFrameToEntities(scene: Scene,frame: float,owner: Entity = None)
def generateDebugThumbnail(force: bool = False)
def getChannel(ent: Entity,cmp: Component,channel: str,createIfNone: bool = True)-> Timeline.Channel
def getComponentChannel(ent: Entity,cmp: Component,createIfNone: bool = True)-> Timeline.ComponentChannel
def getEntityChannel(ent: Entity,createIfNone: bool = True)-> Timeline.EntityChannel
def isKeyframed(ent: Entity,cmp: Component,channel: str)-> bool
def uIDoubleClicked()
Class

Documentation

cave.Documentation

Inherits from Asset

You can use this Documentation asset to write any custom docs, reminders, tutorials, lists you want to help you during development.
It uses Markdown to format it for you.

Enumerations1
Enumeration

AnimationInterpolation

text: SourceCode
Constructors1
def __init__()
Methods1
def generateDebugThumbnail(force: bool = False)
Class

ImageTexture

cave.ImageTexture

Inherits from Texture

Constructors1
def __init__()
def __init__(file: str,forceLinearSpace: bool = False)
def __init__(data: int,size: int,forceLinearSpace: bool = False)
def __init__(rgbaBitmap: int,width: int,height: int,forceLinearSpace: bool = False)
def __init__(other: ImageTexture)
Methods3
def compressDXT()-> bool
def getCopy()-> Texture
def resize(newWidth: int,newHeight: int)-> bool
Class

ProceduralTexture

cave.ProceduralTexture

Inherits from Texture

A Procedural Texture works like any other Texture, except that it is meant to be Procedurall Generated with a Filter Shader. It can be Dynamic (so it is queued to bee updated on the next frame every time Cave detects it's being used) or static, where it is only updated once at Startup/Load and never again. You can also manually call its Update to render the Texture again.

Enumerations1
Enumeration

AnimationInterpolation

filter: PostProcessing.Filter
dynamic: bool
Constructors1
def __init__()
Methods3
def initializeFilter(shaderName: str = 'Default')
def needsUpdate()-> bool
def update()

Remaining

Supporting classes and namespaces that do not fit the main gameplay, utility, or asset groups.

Remaining Classes157
Class

Animation

cave.Animation

Inherits from Asset

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

frameStart: float
frameEnd: float
speed: float
baseArmature: AssetHandler[Armature]
rootMotion: AnimationRootMotion
callbacks: AnimationCallbacks
Constructors1
def __init__()
def __init__(start: float,end: float)
def __init__(other: Animation)
Methods8
def generateDebugThumbnail(force: bool = False)
def getChannel(channelName: str,addIfNone: bool = True)-> AnimationChannels
def getChannels()-> Dict[str, AnimationChannels]
def getMaxAABB(armature: Armature)-> Tuple[Vector3, Vector3]
def getTransformAt(channelName: str,frame: float)-> Transform
def invalidateMaxAABBCache()
def uIDoubleClicked()
def uIThumbnailDrawn(pos: Vector2,size: Vector2)
Class

AnimationCallbacks

cave.AnimationCallbacks

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

onStart: SourceCode
onEnd: SourceCode
onFrame: List[Tuple[float, SourceCode]]
Class

AnimationChannels

cave.AnimationChannels

Enumerations1
Enumeration

AnimationInterpolation

interpolation: AnimationInterpolation
Constructors1
def __init__()
def __init__(other: AnimationChannels)
Methods14
def addPositionKeyframe(frame: float,position: Vector3)
def addRotationKeyframe(frame: float,rotator: Quaternion)
def addScaleKeyframe(frame: float,scale: Vector3)
def drawUISequencer()
def getFloorPositionAt(frame: float)-> Vector3
def getFloorRotationAt(frame: float)-> Quaternion
def getFloorScaleAt(frame: float)-> Vector3
def getPosition(frame: float)-> Vector3
def getRotation(frame: float)-> Quaternion
def getScale(frame: float)-> Vector3
def hasPositionKeyframes()-> bool
def hasRotationKeyframes()-> bool
def hasScaleKeyframes()-> bool
def sort()
Class

AnimationComponentAnimationLayer

cave.AnimationComponentAnimationLayer

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

anim: AssetHandler[Animation]
frameCallbacks: List[int]
loop: bool
priority: int
loops: int
frame: float
speed: float
start: float
end: float
blendTimer: float
blendDuration: float
rootMotion: Vector3
rootMotionLastPos: Vector3
rootMotionLastLoopCount: int
rootMotionSkip: bool
Methods2
def getName()-> str
def getProgress()-> float
Class

AnimationFilter

cave.AnimationFilter

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

defaultBlend: float
blend: Dict[str, float]
Constructors1
def __init__(_defaultBlend: float = 0)
def __init__(other: AnimationFilter)
Methods2
def getBlend(boneName: str)-> float
def setToBone(bone: Bone,value: float,recursive: bool = False)
Class

AnimationRootMotion

cave.AnimationRootMotion

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

channel: str
x: bool
y: bool
z: bool
Class

AnimationSocketComponentCopyInfo

cave.AnimationSocketComponentCopyInfo

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

copy: bool
offset: Vector3
Class

App

cave.App

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

renderer: Renderer
gameSettings: AppGameSettings
config: AppAppDebugConfig
performanceEmulator: AppPerformanceEmulator
debugUI: DebugUI
Methods28
def disableGameLogic()
def enableGameLogic()
def getAssetData()-> AssetData
def getCurrentFrameNumber()-> int
def getDebugUI()-> DebugUI
def getDeltaTime()-> float
def getEvents()-> Events
def getFPS()-> int
def getGameName()-> str
def getGamePath(localPath: str)-> str
def getMousePosition()-> Vector2
def getPythonEnv()-> PythonEnv
def getRenderAspect()-> float
def getScene()-> Scene
def getWindow()-> Window
def hideLoadingScreen()
def isGameLogicEnabled()-> bool
def isLoadingScreenOn()-> bool
def loadGameAssetsFromDisk(separateFiles: bool = True)
def loadPythonScripts()
def reloadGameAssetsFromDisk(separateFiles: bool = True)
def restartCurrentScene()
def run()
def setDebugUI()
def setDebugUI(ui: DebugUI)
def setGamePath(path: str)
def setScene(scene: Scene,forceDirty: bool = False)
def setSceneQueued(scene: Scene)
def showLoadingScreen()
Class

AppAppDebugConfig

cave.AppAppDebugConfig

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

debugPhysics: bool
debugPhysicsConfig: AppAppDebugConfigDebugPhysicsConfig
debugLines: bool
debugPlaySound: bool
debugUseMist: bool
debugApplyPostProcessing: bool
showGameUI: bool
alwaysFocused: bool
Class

AppAppDebugConfigDebugPhysicsConfig

cave.AppAppDebugConfigDebugPhysicsConfig

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

drawWireframe: bool
drawAabb: bool
drawFeaturesText: bool
drawContactPoints: bool
noDeactivation: bool
noHelpText: bool
drawText: bool
profileTimings: bool
enableSatComparison: bool
disableBulletLCP: bool
enableCCD: bool
drawConstraints: bool
drawConstaintsLimits: bool
fastWireframe: bool
drawNormals: bool
Class

AppGameSettings

cave.AppGameSettings

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

limitFps: bool
fps: int
vsync: bool
Methods1
def updateVSync()

Changing the vsync variable alone isn't enough to apply the changes, so you need to call this function after it.

Class

AppPerformanceEmulator

cave.AppPerformanceEmulator

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

active: bool
minFrameCostMs: float
maxFrameCostMs: float
Class

Armature

cave.Armature

Inherits from Asset

Constructors1
def __init__()
Methods13
def addBone(boneName: str,bone: Bone)
def applyDeformation(mesh: Mesh,reloadMesh: bool = True)

This will destructively apply the Armature deformation to the destination mesh, meaning that all bone transforms will be calculated on the CPU and applied to each Vertex. It will also clear the Vertex Joints data. You can use this if you need to retrieve back the final pose of a mesh but CPU side. Keep in mind that is could be an expensive operation.

def drawDebugLines(transform: Transform,scene: Scene,showParenting: bool = False)
def generateDebugThumbnail(force: bool = False)
def getAABB(transf: Transform)-> Tuple[Vector3, Vector3]
def getBone(boneName: str,addIfNone: bool = False)-> Bone
def getBone(id: int)-> Bone
def getBoneNames()-> List[str]
def getBones()-> List[Bone]
def getBoundingBox(keepAspect: bool = True,transf: Transform = None)-> Transform
def hasBone(boneName: str)-> bool
def setBoneParent(child: str,parent: str)
def uIDoubleClicked()
def update(animation: Animation,frame: float,blend: float = 1,filter: AnimationFilter = None)
Class

ArmatureUBO

cave.ArmatureUBO

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

boneCount: int
Class

Asset

cave.Asset

Asset is the main Cave Engine Class. Most Classes inherits from it.
If a class is an Asset, it usually means that it can be Serialized to disk (saved and loaded) by the engine and also be inspected in the Editor.

Enumerations1
Enumeration

CameraCameraType

"Camera" class Enumeration.

name: str
debug: AssetDebug
uID: int
Methods5
def getAssetFileName()-> str
def getAssetTypeName()-> str
def getThumbnail(generateIfNone: bool = True,forceRegenation: bool = False)-> Texture
def getUID()-> int
def getUniqueName()-> str

Unique Name consists in the <Asset Name + ## + UID>

Class

AssetDebug

cave.AssetDebug

Debug information for each Asset is usually meant to be used by the Editor only. There is no garantee that those informations will be persistent or serialized.

Enumerations1
Enumeration

CameraCameraType

"Camera" class Enumeration.

thumbnail: Texture
thumbnailFlip: bool
dirty: boolIf the Asset is Dirty, it means that it needs to be serialized to Disk (Saved). It usually means that the asset was opened and/or modified by the Editor. Being set to true does not mean guaranteed that it WAS in fact modified, but that it was likely to.
serializeAsJson: bool
handler: AssetFile
saveTime: floatHow many time, in seconds, this Asset took to Save to Disk. If < 0, it's unknown or not available.
loadTime: floatHow many time, in seconds, this Asset took to Load from Disk. If < 0, it's unknown or not available.
wasSelected: bool
memory: memory.Monitor
Class

AssetHandler

cave.AssetHandler

Inherits from IAssetHandler, Generic[T]

Constructors1
def __init__(name: str = '')
Methods4
def get(markAsDirty: bool = True)-> T
def makeLocalCopy()
def makeLocalNew()
def makeWeakRef(asset: T)
Class

AssetImporter

cave.AssetImporter

Enumerations1
Enumeration

IAssetHandlerMode

"IAssetHandler" class Enumeration to define the reference level to the current Asset being referenced by the Handler (if any).

data: AssetData
warnings: List[str]
Constructors1
def __init__(filePath: str)
Methods8
def getFileName()-> str
def getFilePath()-> str
def getFilter(asset: Asset)-> bool
def getImportScale()-> float
def getMaxDimension()-> float
def isFiltered(asset: Asset)-> bool
def isValid()-> bool
def sendToApp(globalFilters: AssetImporterFilter = AssetImporterFilter())
Class

AssetImporterFilter

cave.AssetImporterFilter

Enumerations1
Enumeration

IAssetHandlerMode

"IAssetHandler" class Enumeration to define the reference level to the current Asset being referenced by the Handler (if any).

createSubfolder: bool
generatePhysics: bool
filters: Dict[int, bool]
Methods1
def canImport(id: int)-> bool
Class

AudioDevice

cave.AudioDevice

Constructors1
def __init__(_sampleRate: int = 44100)
Methods28
def drawUIMonitor()
def drawUIQueue()
def getAudio(handlerID: int,markAsDirty: bool = True)-> AudioTrack
def getLoops(handlerID: int)-> int
def getPaused(handlerID: int)-> bool
def getPitch(handlerID: int)-> float
def getProgress(handlerID: int)-> float
def getSampleRate()-> int
def getVolume(handlerID: int)-> float
def isPaused(handlerID: int)-> bool
def isPlaying(handlerID: int)-> bool
def isValid(handlerID: int)-> bool
def pause(handlerID: int)
def pauseAll()
def playTrack(audio: AudioTrack,loops: int = 0,volume: float = 1,pitch: float = 1,startPaused: bool = False)-> int
def resumeAll()
def setLoops(handlerID: int,loops: int)
def setPan(handlerID: int,pan: float)
def setPaused(handlerID: int,paused: bool)
def setPitch(handlerID: int,pitch: float)
def setProgress(handlerID: int,progress: float)
def setSource3D(handlerID: int,x: float,y: float,z: float,distance: float)
def setSource3D(handlerID: int,entityID: int,distance: float)
def setVolume(handlerID: int,volume: float)
def stop(handlerID: int)
def stopAll()
def stopTrack(audio: AudioTrack)-> int
def unpause(handlerID: int)
def update(scene: Scene)
Class

AudioTrack

cave.AudioTrack

Inherits from Asset

Constructors1
def __init__()
def __init__(filename: str)
Methods13
def exportOgg(filename: str)
def generateDebugThumbnail(force: bool = False)
def getDuration()-> float
def getNumChannels()-> int
def getNumSamples()-> int
def getSampleRate()-> int
def getSamples()-> List[int]
def getSizeDecoded()-> int
def getSizeOnDisk()-> int
def play(volume: float = 1,loop: int = 0,pitch: float = 1,startPaused: bool = False)-> AudioTrackInstance
def replaceOgg(filename: str)
def stopAll()
def uIDoubleClicked()
Class

AudioTrackInstance

cave.AudioTrackInstance

Enumerations1
Enumeration

IAssetHandlerMode

"IAssetHandler" class Enumeration to define the reference level to the current Asset being referenced by the Handler (if any).

progress: float
volume: float
pitch: float
Constructors1
def __init__(handler: int = 0)
def __init__(other: AudioTrackInstance)
Methods20
def calculate3D(audioPos: Vector3,maxDistance: float = 100)-> bool
def getDuration()-> float
def getPitch()-> float
def getProgress()-> float
def getTrack(markAsDirty: bool = True)-> AudioTrack
def getVolume()-> float
def isActive()-> bool
def isPaused()-> bool
def isPlaying()-> bool
def isValid()-> bool
def pause()
def play(loop: int)
def resume()
def setLoop(loop: int)
def setPan(pan: float)
def setPitch(pitch: float)
def setProgress(value: float)
def setSource3D(source: Entity,maxDistance: float = 100)
def setVolume(value: float)
def stop(fadeOut: float = 0)
Class

BitMask

cave.BitMask

Constructors1
def __init__(enableFirstEight: bool = True)
def __init__(bit: int,invert: bool)
def __init__(other: BitMask)
Methods10
def disable(n: int)
def disableAll()
def enable(n: int)
def enableAll()
def get(n: int)-> bool
def getFloat()-> float
def getUInt()-> int
def intersect(other: BitMask)-> bool
def isEnabled(n: int)-> bool
def set(n: int,value: bool)
Class

Blur

cave.Blur

Enumerations1
Enumeration

TerrainToolAutoPaintRule

"TerrainTool" class Enumeration.

size: float
Constructors1
def __init__(width: int,height: int,imageResReduction: float = 1.0)
Methods6
def blurImage(texture: Texture,blurAmount: int = 6)
def getBlurredImage()-> Texture
def getSize()-> float
def resize(width: int,height: int)
def setSize(size: float = 1)
def useBlurredImage(position: int)
Class

Bone

cave.Bone

Inherits from NodeTransform

Enumerations1
Enumeration

AnimationInterpolation

name: str
ragdoll: BoneRagdollRagdoll Settings for this Bone, used by the AnimationComponent to spawn a proper ragdoll for it.
offset: Matrix4
index: int
Methods14
def applyOffset()
def getAnimatedMatrix()-> Matrix4
def getBindPose()-> Matrix4
def getChildren()-> List[Bone]
def getIndex()-> int
def getOffset()-> Matrix4
def getRestPosition()-> Vector3
def getRestRotation()-> Quaternion
def getRestScale()-> Vector3
def inverseKinematics(targetPosition: Vector3,chainLength: int,blend: float = 1,maxIterations: int = 10,tolerance: float = 0.001)-> int

Computes the optimal rotations for a chain of bones (parents) for this bone to reach the targetPosition while maintaining natural movement constraints. The targetPosition MUST BE in local space (relative to the Armature Entity), so make sure you untransform it first if you're handling world coordinates. Returns the number of iterations spent to evaluate the final pose.

def setIndex(index: int)
def setOffset(offset: Matrix4)
def setRestPose(position: Vector3,rotation: Quaternion,scale: Vector3)
def twoPartIK(targetPosition: Vector3,blend: float = 1,preserveRotation: bool = True)

Two Part IK also solves inverse Kinematics but it is specialized in chain length equal to two and it's usually better (and faster) at doing it than the regular one.

Class

BoneRagdoll

cave.BoneRagdoll

Ragdoll Settings for the Bone, used by the AnimationComponent to spawn a proper ragdoll for it.

Enumerations1
Enumeration

AnimationInterpolation

use: bool
swingA: float
swingB: float
twist: float
leafHeight: floatOnly affects the Ragdoll if this bone is a leaf (meaning it doesn't have any children)
Class

Camera

cave.Camera

Inherits from Transform

The main Camera class. Every scene have its own camera instance. Please notice that this is NOT the same as the Camera Component. You can get the Scene's camera by calling the Scene's getCamera() method.

Enumerations1
Enumeration

CameraCameraType

"Camera" class Enumeration.

PERSPECTIVE: intPerspective Camera
ORTHOGRAPHIC: intOrthographic Camera
renderMask: BitMask
exposure: CameraExposure
gamma: float
useCustomTransform: bool
aperture: floatDEPRECATED. Aperture is Unused, use HDR exposure instead.
nearPlane: float
farPlane: float
Constructors1
def __init__()
Methods21
def getAperture()-> float

DEPRECATED. Aperture is Unused, use HDR exposure instead.

def getFarPlane()-> float
def getMatrix()-> Matrix4
def getNearPlane()-> float
def getOrphographicArea()-> float
def getPerspectiveFov()-> float
def getProjection()-> Matrix4
def getProjection(customAspect: float)-> Matrix4
def getProjectionType()-> Camera.CameraType
def getScreenPos(worldPos: Vector3)-> Vector2

Given a World Position, returns its projected 2D position in the Camera Space.

def getScreenRay(x: float,y: float)-> Vector3

Given a 2D, camera space, position, returns a 3D vector representing the direction from the camera to that position in the world. NOTE: this is NOT a RayCast by itself!

def getUIPos(worldPos: Vector3,clampOutOfBounds: float = -1)-> Vector3

Given a Position in the 3D World, calculates its 2D, UI Element position and returns it to you in the first two dimensions of the output vector (x and y). If the position is BEHIND the camera, the last dimension (Z) will be negative, otherwise, positive. The absolute Z value is also the distance from the worldPos to the Camera. If you pass a positive (from 0.1 to 0.5) value as the clampOutOfBounds parameter, it will clamp the (x, y) to [-clampOutOfBounds, clampOutOfBounds].

def getViewProjection()-> Matrix4
def isOrthographic()-> bool
def isPerspective()-> bool
def isVisible(worldPos: Vector3)-> bool

Returns true if the given worldPos is withing the Camera's Frustum

def setAperture(value: float)

DEPRECATED. Aperture is Unused, use HDR exposure instead.

def setDistances(start: float,end: float)
def setFarPlane(value: float)
def setNearPlane(value: float)
def setOrthographic(orthoArea: float)
def setPerspective(fieldOfView: float)

Field of View in Degrees

Class

CameraExposure

cave.CameraExposure

Enumerations1
Enumeration

CameraCameraType

"Camera" class Enumeration.

eyeAdaptation: bool
value: float
range: Vector2
multiplier: float
adjustSpeed: float
Class

CameraTool

cave.CameraTool

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

config: CameraTool
Constructors1
def __init__()
Methods6
def handleOrbitControls()
def handleScrollZoom()
def isEnabled()-> bool
def mouseLook()
def run()-> bool
def updateMovements()
Class

CaveException

cave.CaveException

Constructors1
def __init__(message: str,file: str = '',line: int = 0)
def __init__(other: CaveException)
Methods1
def what(withStackTrace: bool = True)-> str
Class

CharacterComponentConfig

cave.CharacterComponentConfig

Enumerations1
Enumeration

UIElementComponentStatus

"UIElementComponent" class Enumeration.

fallSpeed: float
gravity: float
jumpSpeed: float
jumpHeight: float
maxSlope: float
Class

CharacterComponentShapeDesc

cave.CharacterComponentShapeDesc

This class is a Descriptor for the Character Component's Shape.

Enumerations1
Enumeration

UIElementComponentStatus

"UIElementComponent" class Enumeration.

height: floatCharacter's Height, in meters.
radius: floatCharacter Collder's Radius, in meters.
offset: Vector3The Collider's offset from the center of the Character Component.
Class

CollisionInfo

cave.CollisionInfo

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

position: Vector3
normal: Vector3
entity: Entity
Class

ConsoleTab

cave.ConsoleTab

Inherits from DebugTab

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

clearOnPlay: bool
limitMessages: bool
messagesLimit: int
Constructors1
def __init__()
Methods6
def clear()
def drawUIFooter()
def getMessageCount()-> int
def getMessages()-> List[ConsoleMessage]
def getName()-> str
def showMessage(message: ConsoleMessage)
Class

Curve

cave.Curve

Constructors1
def __init__()
def __init__(other: Curve)
Methods3
def get(position: float)-> float
def set(value: float)
def setAll(value: float)
Class

DebugTab

cave.DebugTab

Enumerations1
Enumeration

IAssetHandlerMode

"IAssetHandler" class Enumeration to define the reference level to the current Asset being referenced by the Handler (if any).

active: bool
Constructors1
def __init__()
Methods2
def draw(fontScale: float = 1.0)-> bool
def getName()-> str
Class

DebugTool

cave.DebugTool

Enumerations1
Enumeration

IAssetHandlerMode

"IAssetHandler" class Enumeration to define the reference level to the current Asset being referenced by the Handler (if any).

icon: str
name: str
message: str
Methods2
def drawOverlayUI(pos: Vector2,size: Vector2)
def run(hovered: bool)
Class

DebugUI

cave.DebugUI

Enumerations1
Enumeration

IAssetHandlerMode

"IAssetHandler" class Enumeration to define the reference level to the current Asset being referenced by the Handler (if any).

reloadFonts: bool
active: bool
showTopMenu: bool
clipboard: DebugUIDebugClipboard
activeAsset: Asset
activeTimeline: Timeline
activeSourceCode: SourceCode
activeAssetHistoric: List[Asset]
remoteControl: RemoteControl
fontScale: float
Constructors1
def __init__(window: Window)
Methods20
def addDefaults()
def addOrReplaceTab(tab: DebugTab)
def addTab(tab: DebugTab)
def canQuit()-> bool
def draw(window: Window)
def getFontScale()-> float
def getFontScaleGain()-> float
def getSystemDPIFallback()-> float
def importRawAsset(filePath: str)
def loadEditor()
def loadEditorTools()
def notify(message: str)
def resetFontScale()
def resetFontSettings()
def runDPICheck()
def saveProject(dirtyOnly: bool = False)
def setFocus(tab: DebugTab)
def setFontScale(value: float)
def update(events: Events)
def validateFontScaling()-> bool
Class

DebugUIDebugClipboard

cave.DebugUIDebugClipboard

Enumerations1
Enumeration

IAssetHandlerMode

"IAssetHandler" class Enumeration to define the reference level to the current Asset being referenced by the Handler (if any).

entity: Entity
component: Component
Class

EntityMap

cave.EntityMap

Internal Class. The Entity Map is a class instantiated by each Scene to properly store and handle Entities efficiently. You probably don't want to mess with this by hand, since it's an Internal Cave class and the Scene will probably have all the accessors for you do handle the Entities efficiently.

Enumerations1
Enumeration

CameraCameraType

"Camera" class Enumeration.

deleteEntitiesOnDestructor: bool
Constructors1
def __init__()
Methods13
def add(object: Entity)-> Entity
def cancelRemoval(entity: Entity)
def drawDebugUI()
def get(id: int)-> Entity
def get(name: str)-> Entity
def getActive()-> Entity
def getAddQueue()-> List[Entity]
def getAll()-> List[Entity]
def getAllRoots()-> List[Entity]
def getCount()-> int
def getRemoveQueue()-> List[Entity]
def remove(object: Entity)
def setActive(e: Entity,setActiveDebugAsset: bool = True)
def update()
Class

File

cave.File

Enumerations1
Enumeration

FileFileMode

"File" class Enumeration.

READ: intEnum: FileFileMode:# "File" class Enumeration.
WRITE: int
asProjectFile: bool
seek: int
Methods10
def getHeader()-> Version
def getPath()-> str
def getSeek()-> int
def getSize()-> int
def isValid()-> bool
def read(buffer: None,elementSize: int,elements: int)-> bool
def read(buffer: str)-> bool
def read(src: SourceCode)-> bool
def readStr(buffer: str)-> bool
def setSeek(value: int)
def write(buffer: None,elementSize: int,elements: int)-> bool
def write(buffer: str)-> bool
def write(src: SourceCode)-> bool
def writeStr(buffer: str)-> bool
Class

FileBinary

cave.FileBinary

Inherits from File

Enumerations1
Enumeration

FileFileMode

"File" class Enumeration.

seek: int
Constructors1
def __init__(fileName: str,mode: File.FileMode,throwIncompatibility: bool = True)
Methods5
def getSeek()-> int
def getSize()-> int
def read(buffer: None,elementSize: int,elements: int)-> bool
def setSeek(value: int)
def write(buffer: None,elementSize: int,elements: int)-> bool
Class

FileJson

cave.FileJson

Inherits from File

Enumerations1
Enumeration

FileFileMode

"File" class Enumeration.

seek: int
Constructors1
def __init__(fileName: str,mode: File.FileMode)
Methods7
def getSeek()-> int
def getSize()-> int
def read(buffer: None,elementSize: int,elements: int)-> bool
def readStr(buffer: str)-> bool
def setSeek(value: int)
def write(buffer: None,elementSize: int,elements: int)-> bool
def writeStr(buffer: str)-> bool
Class

FileVirtual

cave.FileVirtual

Inherits from File

Enumerations1
Enumeration

FileFileMode

"File" class Enumeration.

seek: int
Constructors1
def __init__(mode: File.FileMode,throwIncompatibility: bool = True,header: bool = True,initialBufferSize: int = 4096)
def __init__(buffer: None,bufferSize: int)
def __init__(other: FileVirtual)
Methods7
def getSeek()-> int
def getSize()-> int
def getUsedSize()-> int
def read(buffer: None,elementSize: int,elements: int)-> bool
def resetMode(mode: File.FileMode)-> bool
def setSeek(value: int)
def write(buffer: None,elementSize: int,elements: int)-> bool
Class

Font

cave.Font

Inherits from Asset

Constructors1
def __init__(resolution: int = 2048)
Methods5
def buildAtlas(filePath: str)
def buildAtlas(data: int,size: int)
def exportTTF(filename: str)
def generateText(text: str,bindMesh: bool = True,scale: float = 1.0,spacing: float = 1)-> Mesh
def replaceTTF(filename: str)
def use(slot: int = 0)
Class

GeometryPaintTool

cave.GeometryPaintTool

Inherits from DebugTool

Enumerations1
Enumeration

GeometryPaintToolAlignRule

"GeometryPaintTool" class Enumeration.

NO_ALIGN: intEnum: GeometryPaintToolAlignRule:# "GeometryPaintTool" class Enumeration.
ALIGN_TO_BRUSH: int
ALIGN_TO_SURFACE: int
brushSize: float
brushStrength: int
parentEntity: int
mask: BitMask
layers: List[Layer]
Constructors1
def __init__()
Methods2
def drawOverlayUI(pos: Vector2,size: Vector2)
def run(hovered: bool)
Class

GeometryPaintToolLayer

cave.GeometryPaintToolLayer

Enumerations1
Enumeration

GeometryPaintToolAlignRule

"GeometryPaintTool" class Enumeration.

base: AssetHandler[EntityTemplate]
minDistance: float
selected: bool
skipItself: bool
rangeScale: Vector2
rangeRoll: Vector2
rangePitch: Vector2
rangeYaw: Vector2
alignRule: AlignRule
Class

IAssetHandler

cave.IAssetHandler

This is the Base Interface class for each Asset Handler. Specific Asset types (Texture, Material, Mesh, etc) will have their own specific Asset Handler implementation, usually described as 'AssetHandler_T_', where 'T' is the specific Asset Type. You will also find them described in the stubs as `AssetHandler[T]`, just for Python Reference (but this is wrong).

Enumerations1
Enumeration

IAssetHandlerMode

"IAssetHandler" class Enumeration to define the reference level to the current Asset being referenced by the Handler (if any).

FROM_ASSET_DATA: intIt means that the Asset is stored within Cave Engine's asset Subsystems (aka it's visible in the Asset Browser).
FROM_WEAK_REF: intIt means that the Asset has a weak reference, likely a direct pointer to an instance and it will NOT be serialized. Meaning that if you save and load (reload) the project, the reference will be gone.
FROM_LOCAL: intIt means that the Asset is locally instantiated, managed and garbage collected by this Asset Handler. It is not registered in the internal Engine's Asset Subsystems.
FROM_ASSET_DATA_WEAK: intForces it to use asset name instead of the ID. As soon as an asset is found, it gets promoted to strong asset data.
name: mutablestr
Methods9
def getAsset(markAsDirty: bool = True,searchChildren: bool = False)-> Asset

Returns a pointer to the Given Asset without any cast (so it will reference the Base Asset class). You may want to use the specific 'get()' method from each AssetHandler to retrieve the reference with a proper cast.

def getAssetUID()-> int
def isFromAssetData()-> bool

True if Mode is FROM_ASSET_DATA.

def isLocal()-> bool

True if Mode is FROM_LOCAL.

def isWeakRef()-> bool

True if Mode is FROM_WEAK_REF.

def makeAssetDataStrong()
def makeAssetDataWeak()
def saveToAssetData(filePath: str = '')-> bool

If the mode is FROM_LOCAL and there is a valid Asset, transfer its ownership to the Engine's Asset Subsystems, effectively adding it to the Asset Browser in the given path. Returns True on success, False on failure (or if the Asset isn't Local).

def setAsset(asset: Asset,strong: bool = True)
def setAsset(name: str,searchChildren: bool = True)

Makes this Handler references an Asset (from Asset Data) by its name.

Class

InstanceInfoUBO

cave.InstanceInfoUBO

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

transform: Matrix4
tint: Vector4
id: IntVector4
terrainData1: Vector4xyz = offset, w = height
terrainData2: Vector4xy = scaleUV, zw = offsetUV
Class

Localization

cave.Localization

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

ENGLISH: intEnum: LocalizationLanguages:# "Localization" class Enumeration.
PORTUGUESE: int
SPANISH: int
LANGUAGE_COUNT: int
current: int
Constructors1
def __init__()
Methods5
def get(text: str)-> str
def getCurrent()-> int
def loadAsJson(filePath: str)
def saveAsJson(filePath: str)
def setCurrent(value: int)
Class

LogicBricks

cave.LogicBricks

Inherits from Asset

Enumerations2
Enumeration

LogicBricksBrickKind

"LogicBricks" class Enumeration.

BRICK_REGULAR: intEnum: LogicBricksBrickKind:# "LogicBricks" class Enumeration.
BRICK_FUNCTION_ENTRY: int
BRICK_FUNCTION_RETURN: int
BRICK_FUNCTION_CALL: int
BRICK_ASSET_HANDLER: int
BRICK_PROPERTY_GET: int
BRICK_PROPERTY_SET: int
BRICK_STATE_MACHINE_TRANSITION_RESULT: int
BRICK_PYTHON_FUNCTION_CALL: int
BRICK_USER_EVENT: int
BRICK_DICTIONARY_GET: int
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

EXECUTION_OK: intEnum: LogicBricksException:# "LogicBricks" class Enumeration.
UNKNOWN_ERROR: int
INVALID_SELF: int
INVALID_PARAM_0: int
INVALID_PARAM_1: int
INVALID_PARAM_2: int
INVALID_PARAM_3: int
INVALID_PARAM_4: int
INVALID_PARAM_5: int
INVALID_PARAM_6: int
INVALID_PARAM_7: int
INVALID_PARAM_8: int
INVALID_PARAM_9: int
INVALID_PARAM_10: int
properties: dict
Constructors1
def __init__()
def __init__(other: LogicBricks)
Methods5
def callUserEventInternal(eventName: str,params: list)
def generateDebugThumbnail(force: bool = False)
def getCurrentEntity()-> Entity
def newBrick(brickName: str)-> LogicBricks.Brick
def runEvent(entity: Entity,eventName: str)
Class

LogicBricksBrick

cave.LogicBricksBrick

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

id: int
className: str
name: str
description: str
propertyName: str
propertyExternal: bool
position: Vector2
kind: LogicBricks.BrickKind
functionOwnerAssetId: int
functionId: int
assetHandler: IAssetHandler
hasFlowInput: bool
hasFlowOutput: bool
inputs: List[LogicBricks.Link]
outputs: List[LogicBricks.Link]
debug: LogicBricksBrick_DebugBrick
Methods1
def isAction()-> bool
Class

LogicBricksComment

cave.LogicBricksComment

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

id: int
title: str
position: Vector2
size: Vector2
collapsed: bool
brickIds: Tuple[int]
commentIds: Tuple[int]
Class

LogicBricksEnumInfo

cave.LogicBricksEnumInfo

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

typeName: str
size: int
isSigned: bool
values: List[LogicBricks.EnumValue]
Class

LogicBricksEnumValue

cave.LogicBricksEnumValue

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

name: str
value: int
Class

LogicBricksFunctionGraph

cave.LogicBricksFunctionGraph

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

id: int
name: str
isPublic: bool
graph: LogicBricks.GraphScope
inputs: List[LogicBricks.Link]
outputs: List[LogicBricks.Link]
entryBrickId: int
returnBrickId: int
Class

LogicBricksGraphScope

cave.LogicBricksGraphScope

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

bricks: Dict[int, LogicBricks.Brick]
comments: Dict[int, LogicBricks.Comment]
linkExecutionTimes: Dict[int, float]
Class

ManipulationTool

cave.ManipulationTool

Inherits from DebugTool

Enumerations1
Enumeration

GeometryPaintToolAlignRule

"GeometryPaintTool" class Enumeration.

gizmoTransform: Matrix4
gizmoMode: int
orientationMode: int
useSnapping: bool
snapPos: float
snapRot: float
snapScl: float
selectedEntities: Tuple[int]
Constructors1
def __init__()
Methods5
def drawOverlayUI(pos: Vector2,size: Vector2)
def getSelectedEntities()-> List[Entity]
def run(hovered: bool)
def undoAction()
def unselectEntities()
Class

Mesh

cave.Mesh

Inherits from Asset

Main class representing a 3D mesh. This class is connected to the GPU and can also be used for Physics and/or custom logics as you wish.

Cave Meshes are indexed, wich means that you will find a list of vertices and also a list of indices that describes each Triangle. **NGONS are not supported in cave**, so make sure that all your polygons are Triangles.

The indices are IDs that maps the access to each Vertex store in the vertices list and every 3 indices represents one triangle.

This rendering method is optimal for games because instead of duplicating vertex data for every triangle, an indexed mesh uses a list of unique vertices and an index buffer that specifies the order in which vertices are used to form triangles. This approach reduces memory usage and improves rendering performance by reusing vertices.

Enumerations1
Enumeration

MeshShadowPassRule

"Mesh" class Enumeration to specify the Rendering behaviour during the Shadow Pass.

USE_CURRENT_LOD_LEVEL: intIf set to this, the Shadow Pass will render the exact same mesh as the one being rendered in the main pass.
ALWAYS_USE_LAST_LOD_LEVEL: intIf set to this, the Shadow Pass will ALWAYS render the last LOD level available, regardless of which one is currentlyt being used in the main pass. This could be a good performance optimization.
SKIP_SHADOW_PASS: intIf set to this, it will NOT render anything during the shadow pass, which also means that this Mesh won't cast any Shadows. Also good for performanceoptimizations.
vertices: List[Vertex]List of all Vertices in the mesh.
joints: List[VertexJoints]List of all Joint Data for vertices. This list needs to either be empty of to have the same amount of elements as the 'vertices' list.
indices: List[int]Index buffer defining faces of the mesh. On every 3 indices, you have one triangle represented. Notice that this list's size (length) must be a multiple of 3 and every element in it must map to a valid ID for the vertices list.
lod0range: floatThe max distance (range) of which this Mesh can be from the Camera while still rendering the highest resolution Level of Detail. Notice that if there are no other levels, it will always render the highest one anyways and this won't be used.'
lod: List[LodData]A list containing all the LOD Levels in ascending order, meaning that the first item will be LOD 1, the second LOD 2 and so on.
distanceCulling: MeshMeshDistanceCullingA structure defining the Distance Culling Settings for this Mesh.
scaleDistances: boolIf enabled, the World Scale of the Mesh will be used to scale the distance culling and also the LOD distances.
shadowPassRule: ShadowPassRuleAn enumeration to specify which ShadowPassRule will be used.
hints: MeshMeshHintsA Struct defining all the Mesh hints used by this Mesh.
Constructors1
def __init__()
def __init__(other: Mesh)
Methods70
def addCone(subdivisions: int = 12,transform: Transform = None)

Adds a Cone Shape into the Mesh, transforming it by the given Transform (optional).

def addCube(transform: Transform = None)

Adds a Cube Shape into the Mesh, transforming it by the given Transform (optional).

def addCylinder(subdivisions: int = 12,transform: Transform = None)

Adds a Plane Cylinder into the Mesh, transforming it by the given Transform (optional).

def addFace(vList: List[Vertex])
def addGrid(gridSize: int = 12,transform: Transform = None)

Adds a Grid Shape into the Mesh, transforming it by the given Transform (optional). A Grid is basically a Plane with subdivisions.

def addLine(origin: Vector3,target: Vector3,color: Vector3)
def addMesh(other: Mesh)
def addMeshAsLod(other: Mesh,lodLevel: int)-> bool
def addMeshTransformed(other: Mesh,transform: Transform)
def addNgon(ngon: List[Vector3])
def addNgon(ngon: List[Vertex])
def addPlane(transform: Transform = None)

Adds a Plane Shape into the Mesh, transforming it by the given Transform (optional).

def addUvSphere(numRings: int = 32,numSegments: int = 16,transform: Transform = None)

Adds an UV Sphere Shape into the Mesh, transforming it by the given Transform (optional).

def addVolume(transform: Transform)
def appendVertex(pos: Vector3,normal: Vector3,tangent: Vector3,uv: Vector2)
def applyMovement(move: Vector3,bindData: bool = True)
def applyShadeFlat()
def applyTransform(transform: Transform,bindData: bool = True)
def bindMeshBuffersData()
def buildMeshWithLod(lodLevel: int,bindData: bool = True)-> Mesh
def decimate(ratio: float = 0.5,reload: bool = True)
def disableShadowRendering()
def draw()
def drawInstanced(instanceCount: int)
def drawLines(width: float = 1)
def drawPoints(thickness: float = 5)
def enableShadowRendering(useLastLod: bool = False)
def flipIndices()
def flipNormals()
def generateDebugThumbnail(force: bool = False)
def generateLodLevels(lodLevels: int = 1,distanceFactor: float = 3,reload: bool = True)
def getAABB(transf: Transform = None)-> Tuple[Vector3, Vector3]
def getAllEdges()-> Tuple[Tuple[int, int]]
def getAverageNormalLength(vertexIdx: int)-> float
def getBoundingBox(keepAspect: bool = True,transf: Transform = None)-> Transform
def getCachedBoundingBox()-> Matrix4
def getClosestPoint(pos: Vector3)-> Vertex

Given a position (in local Mesh space), returns the closest point in the entire mesh surface to that position. The point could be in a vertex, edge or withing the triangle surface.

def getClosestTriangle(pos: Vector3)-> Tuple[IntVector3, Vector3]

Given a position (in local Mesh space), returns an IntVector3 containing the three vertex IDs that builds the closest Triangle to that position. You can use those three IDs to access each Vertex in the vertex list. Also returns the closest position in tha triangle.

def getClosestTriangleID(pos: Vector3)-> Tuple[int, Vector3]

Given a position (in local Mesh space), returns an ID for the closest Triangle to that position. In order to properly sample the 3 vertices that builds this triangle, you need to multiply this ID by 3 and then use it to access the 3 following vertex IDs in the indices list. Also returns the closest position in tha triangle.

def getClosestTriangles(pos: Vector3,count: int)-> List[Tuple[IntVector3, Vector3]]
def getClosestTrianglesIDs(pos: Vector3,count: int)-> List[Tuple[int, Vector3]]
def getClosestVertex(pos: Vector3)-> Vertex

Given a position (in local Mesh space), returns a copy of the closest Vertex to that position.

def getClosestVertexID(pos: Vector3)-> int

Given a position (in local Mesh space), returns an ID for the closest Vertex to that position. This ID can be used to access the vertex in the vertices list.

def getCopy()-> Mesh
def getCurrentIndicesCount()-> int
def getEdges(vertexIdx: int)-> Tuple[int]
def getEdgeTrianglesIDs(e0: int,e1: int)-> List[int]

Given an Edge, returns all other triangles that shares this same edge

def getFaces(vertexIdx: int)-> Tuple[int]
def getLodLevelForDistance(distance: float)-> int
def getObj(indicesOffset: int = 0)-> str
def getPhysicsMesh(createIfNone: bool = True)-> PhysicsMesh
def getRandomPoint()-> Vertex
def getTriangleNeighborsID(triangle: int)-> List[int]

Given a Triangle, returns all other triangles that shares at least one vertice with it.

def hasAnimationData()-> bool
def mergeByDistance(distance: float = 0.001,ignoreUVs: bool = False,ignoreNormals: bool = False,reload: bool = True)

It will merge all vertices that are withing certain minimal distance (distance parameter). It uses Spatial Hashing to find nearby vertices in O(n) time instead of O(n^2) for the naive approach.

def mergeByDistanceFast(decimals: int = 4,reload: bool = True)

This is a fast (and approximate) approach to Merging nearby vertices. It always ignores the UVs and uses the position to generate a round approximation to be able to fastly compare with others. May be imprecise, but it's much faster than the regular mergeByDistance.'

def mergeJointsByDistance(distance: float = 0.001,reload: bool = True)
def mergeVertices(targetIdx: int,otherIdx: int)-> bool
def optimizeMesh(reload: bool = True)

This Method will perform a series of Mesh optimizations to make sure that it is optimal for rendering. This includes Merging the Vertices and Joints by distance, Optimizing Vertex Cache and Overdraw and also optimizing Vertex Fetch. Note: This may be SLOW and probably not suitable (or meant to) for real time use cases.

def rebuildPhysicsMesh()
def recalculateCachedBoundingBox()
def recalculateIndices()
def recalculateNormals()
def recalculateTangents(useUVs: bool = False)
def reload()

Resets the mesh sent to the GPU and send it again.

def removeAnimationJointsIfUnused(reload: bool = True)
def removeLooseVertices(reload: bool = True)

It will search and remove all Vertices that does not belong to any faces.

def reset(resetData: bool = True)

Resets the mesh, clearing all its vertex and indices data and freeing from GPU memory.

def use()-> int
def useLod(lodLevel: int = 0)-> int
def walkInMesh(initialPos: Vector3,initialDir: Vector3,length: float)-> List[Vector3]

Given an initialPos, initialDir and length, it walks in the mesh surface, starting from the closest point in mesh to the initialPos and initially going to the initialDir direction, until it moved the desired length. Returns the map of waypoints to this walk. First one is always the closest point to the initialPos.

Class

MeshLodData

cave.MeshLodData

Enumerations1
Enumeration

MeshShadowPassRule

"Mesh" class Enumeration to specify the Rendering behaviour during the Shadow Pass.

indices: List[int]
range: float
ratio: float
Class

MeshMeshDistanceCulling

cave.MeshMeshDistanceCulling

Enumerations1
Enumeration

MeshShadowPassRule

"Mesh" class Enumeration to specify the Rendering behaviour during the Shadow Pass.

enable: bool
enableDither: bool
distance: float
Class

MeshMeshHints

cave.MeshMeshHints

Enumerations1
Enumeration

MeshShadowPassRule

"Mesh" class Enumeration to specify the Rendering behaviour during the Shadow Pass.

transform: Transform
material: AssetHandler[Material]
armature: AssetHandler[Armature]
animation: AssetHandler[Animation]
Class

MeshProxyComponentProxyMeshSettings

cave.MeshProxyComponentProxyMeshSettings

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

proxyDistance: float
decimation: float
removeDoubles: bool
ignoreUVs: bool
passFilter: PassMask
skipDynamicRbs: bool
skipPythonCmps: bool
skipTemplates: bool
materialFilter: AssetHandler[Material]
useHighestLOD: bool
Class

MouselookAxisConfig

cave.MouselookAxisConfig

Enumerations1
Enumeration

ThirdPersonCamComponentAlignPlayerRule

"ThirdPersonCamComponent" class Enumeration.

use: bool
rotationLocal: bool
rotationAxis: int
rangeMin: float
rangeMax: float
sensitivity: float
threshold: float
m_allowRotationAdjust: bool
Class

NewProjectDescriptor

cave.NewProjectDescriptor

Enumerations2
Enumeration

NewProjectDescriptorButtonStyle

"NewProjectDescriptor" class Enumeration.

BUTTON_FLAT: intEnum: NewProjectDescriptorButtonStyle:# "NewProjectDescriptor" class Enumeration.
BUTTON_GRADIENT: int
Enumeration

NewProjectDescriptorGameMode

"NewProjectDescriptor" class Enumeration.

GAME_EMPTY: intEnum: NewProjectDescriptorGameMode:# "NewProjectDescriptor" class Enumeration.
GAME_FIRST_PERSON: int
GAME_THIRD_PERSON: int
GAME_TOP_DOWN: int
name: str
path: str
credits: str
ui: NewProjectDescriptorUI
game: NewProjectDescriptorGame
createGitIgnore: bool
createAgentsMd: bool
Constructors1
def __init__()
Class

NewProjectDescriptorGame

cave.NewProjectDescriptorGame

Enumerations1
Enumeration

NewProjectDescriptorGameMode

"NewProjectDescriptor" class Enumeration.

mode: GameMode
healthBarColor: Vector3
proceduralSky: bool
skyboxPath: str
numLevels: int
topDownPointAndClick: bool
withTerrain: bool
withTerrain: bool
withPortalTemplate: bool
withDamageTemplate: bool
withVehicleTemplate: bool
withEnemies: bool
withMainMenu: bool
withPauseMenu: bool
Class

NewProjectDescriptorUI

cave.NewProjectDescriptorUI

Enumerations1
Enumeration

NewProjectDescriptorGameMode

"NewProjectDescriptor" class Enumeration.

buttonStyle: ButtonStyle
textColor: Vector3
colorBase: Vector4
colorHovered: Vector4
colorPressed: Vector4
fontRegular: str
fontBold: str
Class

NodeTransform

cave.NodeTransform

Inherits from Transform

Child class from Transform that introduces Parenting to it.

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

worldMatrix: Matrix4
worldPosition: Vector3
Constructors1
def __init__()
def __init__(other: NodeTransform)
Methods18
def addChildren(children: NodeTransform)
def alignAxis(axis: int,direction: Vector3,reference: Vector3 = Vector3(0))
def alignAxisSmooth(axis: int,direction: Vector3,lerp: float = 0.5,reference: Vector3 = Vector3(0))
def getChildren()-> List[NodeTransform]
def getInverseWorldMatrix()-> Matrix4
def getParent()-> NodeTransform
def getWorldEuler()-> Vector3
def getWorldMatrix()-> Matrix4
def getWorldPosition()-> Vector3
def getWorldQuaternion()-> Quaternion
def getWorldRotator()-> Matrix3
def lookAt(direction: Vector3,up: Vector3 = Vector3(0, 1, 0))

Rotates the Transform in a way that it faces towards the given Direction, keeping "up" as the up axis.

def lookAtSmooth(direction: Vector3,lerp: float = 0.5,up: Vector3 = Vector3(0, 1, 0))

Same as "lookAt", except that it allows you to lerp between the current and the final rotation.

def removeChildren(children: NodeTransform)
def removeParent()
def setParent(parent: NodeTransform,keepTransform: bool = False)
def setWorldMatrix(matrix: Matrix4)
def setWorldPosition(pos: Vector3)
def setWorldPosition(x: float,y: float,z: float)
Class

ParticleComponentCurveColors

cave.ParticleComponentCurveColors

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

r: Curve
g: Curve
b: Curve
a: Curve
Class

ParticleComponentOptimizations

cave.ParticleComponentOptimizations

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

cullDistance: float
frameSkips: int
Class

ParticleComponentParticleInstanceDescriptor

cave.ParticleComponentParticleInstanceDescriptor

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

count: int
spawnArea: Vector3
scaleMin: Vector3
scaleMax: Vector3
rotationMin: Vector3
rotationMax: Vector3
isDynamic: bool
useParent: bool
life: float
respawn: float
gravity: Vector3
linearVelocity: Vector3
linearConservation: Vector3
angularVelocity: Vector3
angularConservation: Vector3
Class

ParticleInstance

cave.ParticleInstance

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

life: float
cycles: int
transform: NodeTransform
linearVelocity: Vector3
angularVelocity: Vector3
Class

PathEdge

cave.PathEdge

Path Edge, composed by two Path Points and used in the Path Component.

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

isDirectional: bool
Constructors1
def __init__()
def __init__(origin: UniqueID,target: UniqueID)
def __init__(other: PathEdge)
Methods6
def getOrigin()-> UniqueID
def getPointA()-> UniqueID
def getPointB()-> UniqueID
def getTarget()-> UniqueID
def setOrigin(origin: UniqueID)
def setTarget(target: UniqueID)
Class

PathEdgeControlPoints

cave.PathEdgeControlPoints

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

position: Vector3
use: bool
Class

PathPoint

cave.PathPoint

Inherits from Transform

Path Point, used in the Path Component.

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

id: UniqueID
Constructors1
def __init__()
def __init__(position: Vector3)
def __init__(other: PathPoint)
Class

PathQueryResult

cave.PathQueryResult

Result structure returned by path query functions like GetClosestPointOnPath. Contains the found point, which path element it belongs to, parametric values, and distance information.

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

point: Vector3The closest 3D point found on the path in world coordinates.
edge: PathEdgeThe PathEdge containing the result point. None if the result is exactly on a PathPoint.
pathPoint: PathPointThe PathPoint if the result is exactly on a path point. None if the result is along an edge.
t: floatParameter along the edge (0.0 at from point, 1.0 at to point). Only meaningful when edge is not None.
distance: floatDistance from the query point to the result point.
valid: boolWhether a valid result was found. False if path is empty or query failed.
Class

PathSample

cave.PathSample

Sample point along a path containing position, direction, normal vector, and distance information. Used by path sampling functions for procedural placement and navigation.

Enumerations1
Enumeration

MeshProxyComponentPassMask

"MeshProxyComponent" class Enumeration.

position: Vector33D position of the sample point in world coordinates.
direction: Vector3Normalized forward direction vector at this sample point along the path.
normal: Vector3Normal vector perpendicular to the direction, useful for object orientation and banking effects.
edge: PathEdgeThe PathEdge this sample belongs to.
t: floatParameter along the edge (0.0 to 1.0) where this sample was taken.
distanceFromStart: floatCumulative distance from the start of the path to this sample point.
Class

PathTool

cave.PathTool

Inherits from DebugTool

Enumerations1
Enumeration

GeometryPaintToolAlignRule

"GeometryPaintTool" class Enumeration.

selectedPoints: Tuple[UniqueID]
selectedEdge: PathEdge
selectedControlPoint: int
gizmoTransform: Matrix4
gizmoMode: int
useSnapping: bool
snapDistance: float
Constructors1
def __init__()
Methods2
def drawOverlayUI(pos: Vector2,size: Vector2)
def run(hovered: bool)
Class

PhysicsConstraintComponentConstraintConfig

cave.PhysicsConstraintComponentConstraintConfig

Enumerations1
Enumeration

PhysicsConstraintType

sphereSwingA: float
sphereSwingB: float
sphereTwist: float
sliderLowerLimit: float
sliderUpperLimit: float
sliderLowerAngLimit: float
sliderUpperAngLimit: float
breakThreshold: float
Class

PhysicsMesh

cave.PhysicsMesh

Constructors1
def __init__(mesh: Mesh)
Methods4
def getMeshOwner()-> Mesh
def getPrimitiveInfo()-> Transform
def getTriangleCount()-> int
def hasMeshOwner()-> bool
Class

PhysicsWorld

cave.PhysicsWorld

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

gravity: Vector3
Constructors1
def __init__()
Methods21
def addCharacter(character: CharacterComponent)
def addConstraint(constraint: PhysicsConstraintComponent)
def addRigidBody(body: RigidBodyComponent)
def addTerrain(body: TerrainComponent)
def checkContactBox(box: Transform,mask: BitMask = BitMask())-> List[CollisionInfo]
def checkContactSphere(box: Transform,radius: float,mask: BitMask = BitMask())-> List[CollisionInfo]
def drawDebug()
def getCollisionsWith(body: RigidBodyComponent)-> List[CollisionInfo]
def getCollisionsWith(body: CharacterComponent)-> List[CollisionInfo]
def getDebugInfo()-> PhysicsWorld.PhysicsWorldDebugInfo
def getGravity()-> Vector3
def rayCast(origin: Vector3,target: Vector3,mask: BitMask = BitMask())-> RayCastOut
def rayCastAll(origin: Vector3,target: Vector3,mask: BitMask = BitMask())-> List[RayCastOut]
def removeCharacter(character: CharacterComponent)
def removeConstraint(constraint: PhysicsConstraintComponent)
def removeRigidBody(body: RigidBodyComponent)
def removeTerrain(body: TerrainComponent)
def setGravity(gravity: Vector3)
def sphereCast(origin: Vector3,target: Vector3,radius: float,mask: BitMask = BitMask())-> SphereCastOut
def sphereCastAll(origin: Vector3,target: Vector3,radius: float,mask: BitMask = BitMask())-> List[SphereCastOut]
def sphereCastEntity(ignoreEntity: Entity,origin: Vector3,target: Vector3,radius: float,mask: BitMask = BitMask())-> SphereCastOut
def update()
Class

PhysicsWorldPhysicsWorldDebugInfo

cave.PhysicsWorldPhysicsWorldDebugInfo

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

numBodies: int
ghostBodies: int
staticBodies: int
dynamicBodies: int
shapeConvexHull: int
shapeBoundingBox: int
shapeTriangleMesh: int
triangleMeshPolyCount: int
triangleMeshEntities: List[Tuple[Entity, int]]
numCharacters: int
numCollisionObjects: int
numConstraints: int
Class

PointLightInfoUBO

cave.PointLightInfoUBO

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

position: Vector3
spotAngle: float
color: Vector3
radius: float
direction: Vector3
spotFalloff: float
Class

PointLightsUBO

cave.PointLightsUBO

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

pointLightCount: int
Class

PostProcessingFilter

cave.PostProcessingFilter

Enumerations1
Enumeration

MeshShadowPassRule

"Mesh" class Enumeration to specify the Rendering behaviour during the Shadow Pass.

name: str
active: bool
uniforms: ShaderUniforms
bindPyCodeStaging: SourceCode
bindPyCode: str
shader: ShaderProgram
Constructors1
def __init__(name: str,shaderSource: str = '')
Methods3
def isValid()-> bool
def parseUniforms()
def submit()
Class

ProfilerScopeGroup

cave.ProfilerScopeGroup

Class

ProfilerScopeType

cave.ProfilerScopeType

Class

ProfilerTab

cave.ProfilerTab

Inherits from DebugTab

Constructors1
def __init__()
Methods1
def getName()-> str
Class

ProgressBar

cave.ProgressBar

Constructors1
def __init__(title: str,maxValue: int = 100,hidden: bool = False)
Methods5
def add(value: int)
def getValueMax()-> int
def increment()
def set(value: int,maxValue: int)
def update(progress: int)
Class

PythonCodeComponentOptimizations

cave.PythonCodeComponentOptimizations

Enumerations1
Enumeration

PythonCodeComponentOptimizationPolicy

"PythonCodeComponent" class Enumeration.

policy: OptimizationPolicy
cullDistance: float
executionInterval: float
executionTimer: Timer
applyToUpdate: bool
applyToPausedUpdate: bool
applyToEditorUpdate: bool
Class

PythonCodeComponentPyCodes

cave.PythonCodeComponentPyCodes

Class

RayCastOut

cave.RayCastOut

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

hit: bool
position: Vector3
normal: Vector3
entity: Entity
Constructors1
def __init__()
Class

RegexMatch

cave.RegexMatch

Container to describe one Regex Match and its groups.

Enumerations1
Enumeration

UIEntityPresets

value: strRaw value of the entire Match.
groups: List[str]List of all groups matched in the Raw value.
Class

RemoteControl

cave.RemoteControl

Enumerations1
Enumeration

AnimationInterpolation

active: bool
Constructors1
def __init__(port: int = 4242)
Methods3
def execute(command: str,saveProjectAfter: bool = True)-> str
def getPort()-> int
def listen()
Class

RenderableSun

cave.RenderableSun

Inherits from Camera

Enumerations1
Enumeration

AnimationInterpolation

color: Vector3
intensity: float
shadow: RenderableSunShadowSettings
hour: float
angle: float
Constructors1
def __init__()
Methods8
def alignTransformToView(cam: Camera)
def getAngle()-> float
def getColor()-> Vector3
def getDirection()-> Vector3
def getHour()-> float
def getProjection()-> Matrix4
def setAngle(value: float)
def setHour(value: float)
Class

RenderableSunShadowSettings

cave.RenderableSunShadowSettings

Enumerations1
Enumeration

AnimationInterpolation

cast: bool
pcfSamples: int
pcfRadius: float
bias: float
influence: float
Class

Renderer

cave.Renderer

Inherits from Asset

Enumerations1
Enumeration

MeshShadowPassRule

"Mesh" class Enumeration to specify the Rendering behaviour during the Shadow Pass.

postProcessing: AssetHandler[PostProcessing]
shaderProgramOverride: AssetHandler[ShaderProgram]
msaa: bool
depthPrepass: bool
debug: RendererRendererDebug
Constructors1
def __init__()
Methods17
def getAspect()-> float
def getAssetAt(x: float,y: float)-> Asset
def getDefaultTextures()-> List[Texture]
def getFinalRender()-> Texture
def getFinalRenderBlurred()-> Texture
def getMainShader(markAsDirty: bool = True)-> ShaderProgram
def getNormalAt(x: float,y: float)-> Vector4
def getPositionAt(x: float,y: float)-> Vector4
def getResolution()-> IntVector2
def getShadowTextures()-> List[Texture]
def reloadShadowMaps(shadowRes: IntVector2 = IntVector2(2048))
def render(view: Camera,rGraph: RenderGraph,renderToTexture: bool = False)
def renderToTexture(view: Camera,rGraph: RenderGraph,resolution: IntVector2 = IntVector2(0, 0))-> Texture
def resetLastMemory()
def resetLastMemoryIfCamera(cam: Camera)
def setResolution(width: int,height: int,force: bool = False)
def setResolution(res: IntVector2,force: bool = False)
def setVirtualAspect(aspect: float)
Class

RendererRendererDebug

cave.RendererRendererDebug

Enumerations1
Enumeration

MeshShadowPassRule

"Mesh" class Enumeration to specify the Rendering behaviour during the Shadow Pass.

wireframe: bool
wireframeLineWidth: float
Class

RenderGraph

cave.RenderGraph

Enumerations1
Enumeration

AnimationInterpolation

sun: RenderableSun
config: RenderGraphConfig
postProcessingOverride: AssetHandler[PostProcessing]
shaderProgramOverride: AssetHandler[ShaderProgram]
debug: RenderGraphDebugConfig
Constructors1
def __init__()
Methods16
def add(obj: MeshComponent)
def addLight(obj: LightComponent)
def addProxy(obj: MeshProxyComponent)
def draw(view: Camera,defaultShader: ShaderProgram = None,opaquePass: bool = True,shadowPass: bool = False,depthPrepass: bool = False,cascadeIndex: int = -1,resolution: IntVector2 = IntVector2(2048))
def drawTerrainLayers(view: Camera,defaultShader: ShaderProgram = None)
def getActiveEntityLookup()-> IntVector4
def getEntityFromLookup(pixelCoord: IntVector4)-> Entity
def getEntityLookup(entity: Entity)-> IntVector4
def getShaderPermutations(shadowPass: bool = False,opaquePass: bool = True)-> int
def remove(obj: MeshComponent)-> bool
def removeLight(obj: LightComponent)-> bool
def removeProxy(obj: MeshProxyComponent)
def setActiveEntity(shader: ShaderProgram)
def updateRenderGraph(view: Camera)
def updateShaderUniforms(shader: ShaderProgram)
def updateUniformBuffers(view: Camera)
Class

RenderGraphConfig

cave.RenderGraphConfig

Enumerations1
Enumeration

AnimationInterpolation

applyShading: bool
ambient: RenderGraphConfigAmbient
mist: RenderGraphConfigMist
sky: RenderGraphConfigSky
ao: RenderGraphConfigAO
background: Vector3
ambientCol: Vector3
ambientIntensity: float
Class

RenderGraphConfigAmbient

cave.RenderGraphConfigAmbient

Enumerations1
Enumeration

AnimationInterpolation

use: bool
factor: float
color: Sampler2D
Class

RenderGraphConfigAO

cave.RenderGraphConfigAO

Enumerations1
Enumeration

AnimationInterpolation

enabled: bool
radius: float
intensity: float
bias: float
debug: bool
Class

RenderGraphConfigMist

cave.RenderGraphConfigMist

Enumerations1
Enumeration

AnimationInterpolation

use: bool
start: float
distance: float
falloff: float
intensity: float
color: Sampler2D
Class

RenderGraphConfigSky

cave.RenderGraphConfigSky

Enumerations1
Enumeration

AnimationInterpolation

blur: float
intensity: float
angle: float
color: Sampler2D
Class

RenderGraphDebugConfig

cave.RenderGraphDebugConfig

Enumerations1
Enumeration

AnimationInterpolation

grid: bool
drawPassInfo: List[Tuple[str, DebugDrawPass]]
Class

RenderGraphDebugDrawPass

cave.RenderGraphDebugDrawPass

Enumerations1
Enumeration

AnimationInterpolation

drawCalls: int
drawCallsInstanced: int
meshBindings: int
materialBindings: int
shaderBindings: int
drawnRenderables: int
drawnRenderablesInstanced: int
culledRenderables: int
culledByDistance: int
culledByFullContainment: int
culledByPixelSize: int
culledByPixelSizeThreshold: float
vertices: int
triangles: int
Class

Sampler2D

cave.Sampler2D

Enumerations1
Enumeration

AnimationInterpolation

texture: AssetHandler[Texture]
color: Vector4
Constructors1
def __init__()
def __init__(_texture: Texture)
def __init__(textureName: str)
def __init__(r: float,g: float,b: float,a: float = 1)
def __init__(r: float,g: float,b: float,a: float,assetID: int)
def __init__(r: float,g: float,b: float,a: float,assetID: int,textureName: str)
def __init__(r: float,g: float,b: float,a: float,textureName: str)
def __init__(other: Sampler2D)
Methods6
def asString()-> str
def drawTextureOnlyUI(samplerName: str,icon: str = ICON_FA_PALETTE)
def getTexture(stagingLocation: int,markAsDirty: bool = True)-> Texture
def set(r: float,g: float,b: float,a: float = 1)
def set(value: float)
def setTexture(tex: str)
def use(shader: ShaderProgram,uniform: str,location: int)
Class

SceneTemplateEditor

cave.SceneTemplateEditor

Inherits from Scene

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

reloadOnDestructor: bool
Constructors1
def __init__(base: EntityTemplate)
Methods3
def end()
def endUpdate()
def getBase()-> EntityTemplate
Class

SceneTimer

cave.SceneTimer

Inherits from Timer

Scene Timer class. Inherits from the Timer class and have the same behavior, except that it won't increment time while the Scene is paused. That's probably the timer you want to use in most cases.

Constructors1
def __init__()
def __init__(start: float)
Class

SceneUBO

cave.SceneUBO

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

applyAmbient: int
ambientFactor: float
applyShading: int
mistUse: int
mistStart: float
mistDistance: float
mistFalloff: float
mistIntensity: float
cameraPosition: Vector3
cameraAperture: float
cameraNear: float
cameraFar: float
cameraInvVP: Matrix4
useShadows: int
shadowPCFsamples: int
shadowPCFradius: float
shadowBias: float
shadowBiasAngleScale: float
shadowInfluence: float
sunDir: Vector3
sunColor: Vector3
Class

ShaderUniforms

cave.ShaderUniforms

This class is a container that stores and represents Shader Uniforms in a way that you can see, access and modify.

Enumerations1
Enumeration

ShaderLocations

The ShaderLocations enum specifies where to bind each Texture in the main render pass. It's used internally by the engine.

order: List[str]
Constructors1
def __init__()
def __init__(other: ShaderUniforms)
Methods7
def bind(shader: ShaderProgram,nextTexLocation: int)
def get(name: str)-> Any

Given an Uniform name, returns its value or None if it doesn't exist.

def getAll()-> dict

Returns a dictionary containing A COPY of all Uniforms and Values.

def parse(shaderSource: str)

Given a shader source code, parses it and includes all its uniform values to this class.

def reset()

Clears all the Uniform lists, deleting them all.

def set(name: str,value: Any)

Given an Uniform name, sets it to the provided value. Creates a new uniform if there was no one with this name.

def sync(base: ShaderUniforms)

Syncs this uniforms with the base Shader Uniform, meaning that any uniform in this class that does not exist in the base Shader Uniforms will be deleted and any new/different uniform in it will be added to this one.

Class

SourceCode

cave.SourceCode

Enumerations1
Enumeration

SourceCodeSourceType

"SourceCode" class Enumeration.

PYTHON: intEnum: SourceCodeSourceType:# "SourceCode" class Enumeration.
GLSL: int
MARKDOWN: int
source: str
Methods5
def __eq__(other)-> bool

self == other

def __eq__(other)-> bool

self == other

def __ne__(other)-> bool

self != other

def __ne__(other)-> bool

self != other

def __str__()-> str
def getWatchPath()-> str
def watch()-> bool
Class

SphereCastOut

cave.SphereCastOut

Inherits from RayCastOut

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

penetration: float
recoveryPosition: Vector3
Constructors1
def __init__()
Class

SpikeInfo

cave.SpikeInfo

Enumerations1
Enumeration

AnimationInterpolation

frameIndex: int
frameTimeMs: float
worstScope: str
worstScopeTimeUs: int
Class

StateMachineInstance

cave.StateMachineInstance

Enumerations1
Enumeration

SourceCodeSourceType

"SourceCode" class Enumeration.

properties: dict
Constructors1
def __init__()
def __init__(asset: StateMachine,owner: Entity,props: dict)
Methods7
def end()
def getCurrentState()-> StateMachine.State
def getCurrentStateChain()-> List[StateMachine.State]
def getOwner()-> Entity
def setState(id: UniqueID)
def start()
def update()
Class

StateMachineState

cave.StateMachineState

Enumerations1
Enumeration

SourceCodeSourceType

"SourceCode" class Enumeration.

name: str
id: UniqueID
onEnter: SourceCode
onUpdate: SourceCode
onExit: SourceCode
pos: Vector2
initialState: int
children: List[StateMachine.State]
transitions: List[Transition]
Methods1
def configureLogicGraphs()
Class

StateMachineTransition

cave.StateMachineTransition

Enumerations1
Enumeration

SourceCodeSourceType

"SourceCode" class Enumeration.

priority: int
rule: SourceCode
Methods5
def configureLogicGraph()
def getOrigin()-> UniqueID
def getTarget()-> UniqueID
def setOrigin(origin: UniqueID)
def setTarget(target: UniqueID)
Class

StatsForNerdsTab

cave.StatsForNerdsTab

Inherits from DebugTab

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

counters: StatsForNerdsTabCounters
time: StatsForNerdsTabTimers
Constructors1
def __init__()
Methods5
def getName()-> str
def onFirstLoad()
def onGameStart()
def onGameStop()
def updateTimers()
Class

StatsForNerdsTabCounters

cave.StatsForNerdsTabCounters

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

loadedTheProject: int
savedTheProject: int
startedTheGame: int
Class

StatsForNerdsTabTimers

cave.StatsForNerdsTabTimers

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

inEditor: float
inGame: float
Class

TerrainLayer

cave.TerrainLayer

Enumerations1
Enumeration

PythonCodeComponentOptimizationPolicy

"PythonCodeComponent" class Enumeration.

material: AssetHandler[Material]
stencil: AssetHandler[Texture]
uvScale: Vector2
Class

TerrainTool

cave.TerrainTool

Inherits from DebugTool

Enumerations3
Enumeration

TerrainToolAutoPaintMode

"TerrainTool" class Enumeration.

COLOR_SET: intEnum: TerrainToolAutoPaintMode:# "TerrainTool" class Enumeration.
COLOR_ADD: int
COLOR_SUBTRACT: int
Enumeration

TerrainToolAutoPaintRule

"TerrainTool" class Enumeration.

TERRAIN_HEIGHT: intEnum: TerrainToolAutoPaintRule:# "TerrainTool" class Enumeration.
TERRAIN_STEEPNESS: int
TERRAIN_NOISE: int
mode: TerrainMode
brush: TerrainToolTerrainBrush
noiseOffset: Vector2
noiseScale: float
setHeight: float
paintWeight: float
paintLayer: int
autoPaint: TerrainToolAutoPaint
pathEntityName: str
pathHeightOffset: float
Enumeration

TerrainToolTerrainMode

"TerrainTool" class Enumeration.

MODE_SCULPT: intEnum: TerrainToolTerrainMode:# "TerrainTool" class Enumeration.
MODE_ERASE: int
MODE_SMOOTH: int
MODE_FLATTEN: int
MODE_SET: int
MODE_EROSION: int
MODE_NOISE: int
MODE_LAYER_PAINT: int
MODE_PATH: int
Constructors1
def __init__()
Methods4
def drawOverlayUI(pos: Vector2,size: Vector2)
def registerUndo(hMap: Texture)
def run(hovered: bool)
def undo(hMap: Texture)-> bool
Class

TerrainToolAutoPaint

cave.TerrainToolAutoPaint

Enumerations1
Enumeration

TerrainToolAutoPaintRule

"TerrainTool" class Enumeration.

curve: Curve
rule: AutoPaintRule
mode: AutoPaintMode
Class

TerrainToolTerrainBrush

cave.TerrainToolTerrainBrush

Enumerations1
Enumeration

TerrainToolAutoPaintRule

"TerrainTool" class Enumeration.

size: float
falloff: float
strength: float
Class

ThirdPersonCamComponentCamCollisionConfig

cave.ThirdPersonCamComponentCamCollisionConfig

Enumerations1
Enumeration

ThirdPersonCamComponentAlignPlayerRule

"ThirdPersonCamComponent" class Enumeration.

use: bool
radius: float
mask: BitMask
Class

ThirdPersonCamComponentMouselook

cave.ThirdPersonCamComponentMouselook

Enumerations1
Enumeration

ThirdPersonCamComponentAlignPlayerRule

"ThirdPersonCamComponent" class Enumeration.

sensitivity: Vector2
threshold: Vector2
pitchLimit: Vector2
Class

ThreadPool

cave.ThreadPool

Constructors1
def __init__(numThreads: int)
def __init__(other: ThreadPool)
Methods3
def enqueue(task: ThreadPool.Task)
def getThreadCount()-> int
def waitAll()
Class

TimedLerp

cave.TimedLerp

This class lerps, in a given time in seconds, one value (current) to another (destination). After the lerp is finished, it will always return the destination value.

Constructors1
def __init__(current: float = 0,destination: float = 1,durationInSeconds: float = 1)
def __init__(other: TimedLerp)
Methods3
def get()-> float
def isFinished()-> bool

Checks if the class has finished the lerping process.

def set(current: float,destination: float = 1,durationInSeconds: float = 1)
Class

TimelineAudioInstance

cave.TimelineAudioInstance

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

assetID: int
volume: float
pitch: float
start: float
end: float
Methods2
def __eq__(other)-> bool

self == other

def __ne__(other)-> bool

self != other

Class

TimelineChannel

cave.TimelineChannel

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

blend: Timeline.ChannelBlend
Constructors1
def __init__()
def __init__(other: Timeline.Channel)
Methods17
def applyAutoKeyframe(frame: float,cmp: Component)
def calculateFrame(frame: float,cmp: Component)
def find(frame: float,epsilon: float = 0.0001)-> int
def findCeil(frame: float)-> int
def findFloor(frame: float)-> int
def getFrame(id: int)-> float
def getFrames()-> List[Tuple[float, Any]]
def getFrameValue(frame: float)-> Any
def getFrameValue(id: int)-> Any
def getNumFrames()-> int
def getValuePy(cmp: Component)-> Any
def move(frame: float,newFrame: float,epsilon: float = 0.0001)-> bool
def move(id: int,newFrame: float)-> bool
def remove(id: int)
def set(frame: float,value: Any,epsilon: float = 0.0001)
def set(id: int,value: Any)
def setFrame(id: int,newFrame: float)
def setProp(propName: str)
def setProp(getterName: str,setterName: str)
def setValuePy(cmp: Component,obj: Any)
def sortFrames()
Class

TimelineComponentChannel

cave.TimelineComponentChannel

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

id: int
localID: Tuple[str, int]
channels: Dict[str, Timeline.Channel]
Methods1
def getComponent(ent: Entity)-> Component
Class

TimelineEntityChannel

cave.TimelineEntityChannel

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

id: int
nameID: str
components: List[Timeline.ComponentChannel]
Methods9
def findFrameID(frame: float,epsilon: float = 0.0001)-> int
def getActiveList()-> List[Tuple[float, bool]]
def getEntity(scene: Scene,owner: Entity = None)-> Entity
def getFrameID(frame: float)-> int
def isActive(frame: float)-> bool
def remove(id: int)
def setActive(frame: float,active: bool)
def setActive(id: int,active: bool)
def setFrame(id: int,newFrame: float)
def sortFrames()
Class

TimelinePlayer

cave.TimelinePlayer

Enumerations1
Enumeration

TimelineChannelBlend

"Timeline" class Enumeration.

timeline: AssetHandler[Timeline]
frame: float
loop: bool
loops: int
playWhenPaused: bool
Constructors1
def __init__(_timeline: Timeline = None)
Methods3
def isActive()-> bool
def isFinished()-> bool
def update(scene: Scene)
Class

Timer

cave.Timer

Timer class that counts elapsed time in seconds. Keep in mind that it keeps counting time even if the scene is paused. If you don't want that, check the SceneTimer instead.

Constructors1
def __init__()
def __init__(start: float)
Methods3
def get()-> float

Gets the elapsed time in seconds.

def reset()

Resets the elapsed time to zero and starts counting again.

def set(value: float)

Sets the elapsed time to a given amount of seconds and continues to count from that point.

Class

Transform

cave.Transform

This is the Main Transform class. It uses a VQS system to handle Position, Rotation (in Euler, Quaternion and/or Matrix) and Scale. You can also obtain its model Matrix4 and so on.

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

worldMatrix: Matrix4The Transform's world Model Matrix4.
position: Vector3Transform's local Position.
quaternion: QuaternionTransform's local Rotation represented as a Quaternion.
euler: Vector3Transform's local Rotation represented in Euler Angles.
rotator: Matrix3Transform's local Rotation represented as a Matrix3.
scale: Vector3Transform's local Scale.
matrix: Matrix4A Matrix4 representing its Local Transform (Model).
Constructors1
def __init__()
def __init__(mat: Matrix4)
def __init__(other: Transform)
Methods55
def alignAxis(axis: int,direction: Vector3,reference: Vector3 = Vector3(0))
def alignAxisSmooth(axis: int,direction: Vector3,lerp: float = 0.5,reference: Vector3 = Vector3(0))
def alignAxisToPosition(axis: int,position: Vector3,reference: Vector3 = Vector3(0))
def alignAxisToPositionSmooth(axis: int,position: Vector3,lerp: float = 0.5,reference: Vector3 = Vector3(0))
def applyLocalMovement(x: float,y: float,z: float)

Applies the (x, y, z) moviment while also considering the Transform's rotation.

def applyLocalMovement(movement: Vector3)

Applies the moviment while also considering the Transform's rotation.

def applyMovement(x: float,y: float,z: float)

Applies the (x, y, z) moviment by directly adding it to the Transform's position.

def applyMovement(position: Vector3)

Applies the moviment by directly adding it to the Transform's position.

def applyTransform(other: Transform)

Transforms this using another Transform

def getCacheVersion()-> int
def getEuler()-> Vector3
def getForwardVector(world: bool = False)-> Vector3

The vector representing where the Transform's Z Axis is pointed to. If world is True, it will take its parent Transform into account (this is what you probably want in most of the cases).

def getInverseMatrix()-> Matrix4
def getInverseWorldMatrix()-> Matrix4
def getMatrix()-> Matrix4
def getPitch()-> float

The Pitch is the Angle (in Radians) of Rotation of the Transform around its X Axis (Local).

def getPosition()-> Vector3

Returns a COPY of the Position.

def getQuaternion()-> Quaternion
def getRightVector(world: bool = False)-> Vector3

The vector representing where the Transform's X Axis is pointed to. If world is True, it will take its parent Transform into account (this is what you probably want in most of the cases).

def getRoll()-> float

The Pitch is the Angle (in Radians) of Rotation of the Transform around its Z Axis (Local).

def getRotationMatrix()-> Matrix4
def getRotator()-> Matrix3
def getScale()-> Vector3

Returns a COPY of the Scale.

def getScaleCopy()-> Vector3
def getUpVector(world: bool = False)-> Vector3

The vector representing where the Transform's Y Axis is pointed to. If world is True, it will take its parent Transform into account (this is what you probably want in most of the cases).

def getWorldMatrix()-> Matrix4
def getWorldPosition()-> Vector3
def getWorldRotator()-> Matrix3
def getWorldScale()-> Vector3
def getYaw()-> float

The Pitch is the Angle (in Radians) of Rotation of the Transform around its Y Axis (Local).

def lerp(target: Transform,lerp: float = 0.5)

Lerps a Transform into other by linearly interpolating the Position and Scale and using sLerp for the Rotation (Quaternions).

def lookAt(direction: Vector3,up: Vector3 = Vector3(0, 1, 0))

Rotates the Transform in a way that it faces towards the given Direction, keeping "up" as the up axis.

def lookAtPosition(position: Vector3,up: Vector3 = Vector3(0, 1, 0))

Rotates the Transform in a way that it faces a Direction towards the given Position, keeping "up" as the up axis.

def lookAtPositionSmooth(position: Vector3,lerp: float = 0.5,up: Vector3 = Vector3(0, 1, 0))

Same as "lookAtPosition", except that it allows you to lerp between the current and the final rotation.

def lookAtSmooth(direction: Vector3,lerp: float = 0.5,up: Vector3 = Vector3(0, 1, 0))

Same as "lookAt", except that it allows you to lerp between the current and the final rotation.

def move(value: Vector3,local: bool = True)
def move(x: float,y: float,z: float,local: bool = True)
def rotate(x: float,y: float,z: float)

Rotates the Transform Locally using Radians.

def rotateEuler(x: float,y: float,z: float)

Rotates the Transform Locally using Euler Angles (Degrees).

def rotateOnAxis(radians: float,axis: Vector3)

Rotates the Transform around a given 3D Axis (that can be anything).

def rotateOnPitch(radians: float,world: bool = False)

Rotates the Transform around its X Axis. If world is True, it will take its parent Transform into account.

def rotateOnRoll(radians: float,world: bool = False)

Rotates the Transform around its Z Axis. If world is True, it will take its parent Transform into account.

def rotateOnYaw(radians: float,world: bool = False)

Rotates the Transform around its Y Axis. If world is True, it will take its parent Transform into account.

def rotateVector(vec: Vector3)-> Vector3
def set(other: Transform)
def setEuler(x: float,y: float,z: float)
def setEuler(euler: Vector3)
def setMatrix(matrix: Matrix4)
def setPosition(x: float,y: float,z: float)

Sets its Local position to (x, y, z).

def setPosition(position: Vector3)

Sets its Local position to be the provided parameter.

def setQuaternion(x: float,y: float,z: float,w: float)
def setQuaternion(quaternion: Quaternion)
def setRotator(rotator: Matrix3)
def setScale(scalar: float)
def setScale(x: float,y: float,z: float)
def setScale(scale: Vector3)
def setWorldMatrix(matrix: Matrix4)
def sLerpQuaternion(target: Quaternion,lerp: float = 0.5)

Lerps the Transform's Rotation (Quaternion) into another by using sLerp.

def transformDirection(dir: Vector3)-> Vector3
def transformVector(vec: Vector3)-> Vector3
def unrotateVector(vec: Vector3)-> Vector3
def untransformDirection(dir: Vector3)-> Vector3
def untransformVector(vec: Vector3)-> Vector3
Class

UICanvas

cave.UICanvas

Constructors1
def __init__()
Methods5
def add(element: UIElementComponent)
def draw()
def getAll()-> List[UIElementComponent]
def remove(element: UIElementComponent)
def updateElements()
Class

UIElementComponentFontConfig

cave.UIElementComponentFontConfig

Enumerations1
Enumeration

UIElementComponentStatus

"UIElementComponent" class Enumeration.

color: Vector4
scale: float
spacing: float
hScale: float
lineHeight: float
textAlign: int
textAnchor: int
Class

UIElementComponentFontDesc

cave.UIElementComponentFontDesc

Enumerations1
Enumeration

UIElementComponentStatus

"UIElementComponent" class Enumeration.

source: AssetHandler[Font]
config: FontConfig
text: str
Class

UIElementComponentQuadDesc

cave.UIElementComponentQuadDesc

Enumerations1
Enumeration

UIElementComponentStatus

"UIElementComponent" class Enumeration.

style: UIStyle
styleOverride: AssetHandler[UIStyle]
hoverable: bool
clickable: bool
Class

UIRect

cave.UIRect

Enumerations1
Enumeration

AnimationInterpolation

left: float
right: float
top: float
bottom: float
Constructors1
def __init__()
def __init__(l: float,r: float,t: float,b: float)
Methods6
def getCenter()-> Vector2
def getHeight()-> float
def getScale()-> Vector2
def getWidth()-> float
def isPointInside(point: Vector2)-> bool
def snapToGrid(gridSize: float = 0.05)
Class

UIStyleColor

cave.UIStyleColor

Enumerations1
Enumeration

AnimationInterpolation

image: AssetHandler[Texture]
tint: Vector3
alpha: float
blurBackground: float
Constructors1
def __init__()
def __init__(other: UIStyle.Color)
Class

UIVector

cave.UIVector

This class is Specifically used when handling Game User Interfaces, since it can have either absolute (in pixels) or relative (in percentage, 0 to 1) x and y values.
It also holds anchoring information for each Axis. You need to check if the axis is using relative values (if not, then it is using its pixel values). Directly setting a relative OR pixel value changes this.

Enumerations1
Enumeration

AnimationInterpolation

relativeX: boolIts relative position on the X axis (same as relative.x).
relativeY: boolIts relative position on the Y axis (same as relative.y).
anchoring: IntVector2Its anchor points (x and y axis). Each axis can be -1, 0 or 1.
pixel: IntVector2Its absolute position (x and y) in screen pixels.
relative: Vector2Its relative position (x and y).
anchoringX: intIts anchor point on the X axis (same as anchoring.x). Can be -1, 0 or 1.
anchoringY: intIts anchor point on the Y axis (same as anchoring.y). Can be -1, 0 or 1.
Constructors1
def __init__()
def __init__(other: UIVector)
def __init__(x: float,y: float)
Methods19
def asString()-> str
def get(parentScale: Vector2 = Vector2(1, 1))-> Vector2
def getAnchoringX()-> int
def getAnchoringY()-> int
def getPixel()-> IntVector2

Getter for the pixel variable.

def getRelative()-> Vector2

Getter for the relative variable.

def getX(parentScale: float = 1)-> float
def getY(parentScale: float = 1)-> float
def isRelativeX()-> bool

Checks if the X axis should use its relative (returns True) or pixel value (returns False).

def isRelativeY()-> bool

Checks if the Y axis should use its relative (returns True) or pixel value (returns False).

def set(value: Vector2,parentScale: Vector2 = Vector2(1, 1))
def setAnchoringX(value: int)
def setAnchoringY(value: int)
def setPixel(x: int,y: int)

Setter for the pixel variable

def setPixel(value: IntVector2)

Setter for the pixel variable

def setPixelX(x: int)
def setPixelY(y: int)
def setRelative(x: float,y: float)

Setter for the relative variable

def setRelative(value: Vector2)

Setter for the relative variable.

def setRelativeX(x: float)
def setRelativeY(y: float)
Class

UniformBuffer

cave.UniformBuffer

Constructors1
def __init__(size: int,bindingPoint: int)
Methods3
def setBufferData(offset: int,ptrData: None,dataSize: int)
def use()
def useAndSetBufferData(offset: int,ptrData: None,dataSize: int)
Class

UniqueID

cave.UniqueID

Constructors1
def __init__()
def __init__(other: UniqueID)
Methods6
def __eq__(other)-> bool

self == other

def __lt__(other)-> bool

self < other

def __ne__(other)-> bool

self != other

def __str__()-> str
def get()-> int
def set(value: int)
Class

VehicleComponentEngine

cave.VehicleComponentEngine

Enumerations1
Enumeration

RigidBodyShape

acceleration: float
reverse: float
brake: float
Class

VehicleComponentSteering

cave.VehicleComponentSteering

Enumerations1
Enumeration

RigidBodyShape

clamp: float
increment: float
Class

Version

cave.Version

Enumerations1
Enumeration

LogicBricksException

"LogicBricks" class Enumeration.

major: int
minor: int
patch: int
Constructors1
def __init__()
def __init__(versionStr: str)
def __init__(major: int,minor: int,patch: int)
def __init__(other: Version)
Methods7
def __eq__(other)-> bool

self == other

def __ge__(other)-> bool

self >= other

def __gt__(other)-> bool

self > other

def __le__(other)-> bool

self <= other

def __lt__(other)-> bool

self < other

def getVersionStr()-> str
def isCompatible(other: Version,breakPath: bool = False)-> bool
Class

Vertex

cave.Vertex

Represents a single vertex in the mesh. It is the minimum amount of data that each Vertex composing a Mesh in Cave needs to have.

Enumerations1
Enumeration

TerrainToolAutoPaintRule

"TerrainTool" class Enumeration.

position: Vector3Position of the vertex in 3D space, local do the Mesh.
normal: Vector3A vector perpendicular to the surface of a vertex or face. Normals are essential for lighting calculations as they define how light interacts with the surface.
tangent: Vector3A vector that lies along the surface of the vertex, pointing in the direction of the texture mapping. Tangents are primarily used for normal mapping to simulate fine surface details.
uv: Vector2A 2D coordinate that maps a texture to the surface of a 3D mesh. The U and V axes represent the horizontal and vertical directions on the texture image. UV coordinates allow textures to 'wrap' around a mesh.
Constructors1
def __init__()

Initializes a default Vertex with all set to zero.

def __init__(other: Vertex)
def __init__(pos: Vector3,nor: Vector3,tan: Vector3,_uv: Vector2)

Initializes the vertex with position, normal, tangent, and UV data.

Class

VertexInfo

cave.VertexInfo

A wrapper containing all possible Vertex information.

Enumerations1
Enumeration

TerrainToolAutoPaintRule

"TerrainTool" class Enumeration.

data: VertexReference to the vertex data (Vertex class).
joints: VertexJointsJoint and weight data for the vertex (VertexJoints class).
Class

VertexJoints

cave.VertexJoints

Holds Joint and Weight information for Skinned mesh vertices. This is optional for Cave meshes and only exists if the Mesh is meant to be used with an Armature + Animation.

Cave can handle up to 4 weights per vertex, meaning that the maximum amount of Bones that can deform them is 4. Those bones and weights are recpectively defined by the jointIDs and weights, where an ID equals to -1 means no Bone (so it will be skipped). Sum of all valid (ID != -1) Weights must be equal to 1.0.

Enumerations1
Enumeration

TerrainToolAutoPaintRule

"TerrainTool" class Enumeration.

weights: Vector4A set of values that determine the influence of each joint (bone) on a vertex. These are used in skeletal animations to smoothly deform a mesh as the joints move.
jointIDs: Vector4Identifiers (IDs) that represent the specific joints (bones) influencing the vertex. Each ID corresponds to a joint in the armature that affects the vertex during animation.
Constructors1
def __init__()

Initializes the class with all IDs set to -1 and weights set to 0.0.

Class

ViewportTab

cave.ViewportTab

Inherits from DebugTab

This is where you'll be seeing most of the 3D world of your project.
Including Scenes, Entity Templates and so on.

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

config: ViewportTabViewportConfig
displayMessage: str
Constructors1
def __init__()
Methods9
def addTool(tool: DebugTool,makeCurrent: bool = False)
def getCurrentTool()-> DebugTool
def getMouseSurfacePos()-> Vector2
def getName()-> str
def getViewportSize()-> Vector2
def isUIElementsHovered()-> UIElementComponent
def scheduleStopGame()
def startGame()
def stopGame()
Class

ViewportTabViewportConfig

cave.ViewportTabViewportConfig

Enumerations1
Enumeration

LocalizationLanguages

"Localization" class Enumeration.

drawDebugIcons: bool
debugShadowMap: bool
debugRenderOut: bool
showHistogram: bool
Class

ViewportToolAsset

cave.ViewportToolAsset

Inherits from Asset

Constructors1
def __init__(owner: ViewportTab)
Class

WheelComponentControls

cave.WheelComponentControls

Enumerations1
Enumeration

RigidBodyShape

hasTraction: boolIf enabled, this Wheel will Spin then the Vehicle applies any Forces.
hasBrake: boolIf enabled, this Wheel will lock when the Vehicle Brakes.
Class

WheelComponentTuningConfig

cave.WheelComponentTuningConfig

Enumerations1
Enumeration

RigidBodyShape

suspensionStiffness: floatDefines how stiff or soft the suspension is. Higher values result in a stiffer suspension, providing less movement under load, while lower values give a softer suspension with more bounce.
suspensionCompression: floatControls how much the suspension compresses under load or during acceleration/braking. It affects the rate of compression when the vehicle hits bumps or dips.
suspensionDamping: floatGoverns how quickly the suspension returns to its normal position after compression or extension. A higher damping value slows down the suspension’s rebound, providing a more stable ride.
suspensionTravelCmMax: floatSpecifies the maximum distance (in centimeters) the suspension can compress or extend. It limits how far the suspension can move when encountering obstacles or changes in terrain.
suspensionForceMax: floatSets the maximum force that the suspension can exert to resist compression or extension. This value prevents the suspension from being overwhelmed by extreme forces.
frictionSlip: floatDefines the amount of friction between the tires and the ground. Higher values increase grip, while lower values cause more sliding and less traction
Class

Window

cave.Window

Enumerations1
Enumeration

WindowType

"Window" class Enumeration.

CUSTOM: intEnum: WindowType:# "Window" class Enumeration.
MAXIMIZED: int
FULLSCREEN: int
title: str
Methods24
def getAspect()-> float
def getDisplayIndex()-> int
def getMousePosition(normalize: bool = False)-> Vector2
def getTitle()-> str

Returns the window Title

def getWindowPosition()-> Vector2
def getWindowSize()-> Vector2
def hasInputFocus()-> bool
def hasMouseFocus()-> bool
def hide()
def isFullscreen()-> bool
def isHidden()-> bool
def isMaximized()-> bool
def isMinimized()-> bool
def isShown()-> bool
def maximize()
def minimize()
def restore()
def setFullscreen(value: bool)
def setMousePosition(x: int,y: int)
def setMousePositionX(value: int)
def setMousePositionY(value: int)
def setTitle(title: str)

Changes the Window title.

def show()
def toggleFullscreen()
Namespace

cave.ui

The cave.ui submodule is ONLY for the Editor and does NOT exist in the
standalone (exported) Game. You can use this submodule to create custom Cave
Tabs, Tools, Plugins, etc that will run within the Editor Boundaries.

This is meant for you to create your own Editor Tab Tools. If you create a new
script for an EditorTool, don't forget to add this to its first line:

#editoronly

(A comment saying editoronly) So the code doesn't get executed by the engine
in the exported game.

In order to run it, in the Text Editor, go to:
> Editor Tools... > Register Debug Tab... > ExampleTab

This is a Sample Script:

class ExampleTab(cave.ui.DebugTab):
def __init__(self):
super().__init__()
self.counter = 0

def draw(self):
ui.text("This is a Sample Tool!")
ui.separator()
ui.text("You can modify the Counter below of click the Button to increase it.")

self.counter = ui.prop("Counter", self.counter)
if ui.button("Increase counter +1"):
self.counter += 1
print("Counter Increased by +1!")

ImGui Tips:

Cave internally uses a modified Dear ImGui version to handle the Editor UI
and this API here also exposes to you some of it. So here is some tips:

- Most things, such as buttons, headers, trees, props, uses the name/title
as the unique ID. This means that if you have multiple elements with the same
name, it will malfunction. In this case, you can use an "#" to add extra
text to be used as an ID, but everything after the "#" won't be rendered.
So if you have two elements: "Element#n1" and "Element#n2", they will both be
displayed as just "Element", but the extra text will be used as the ID.

- Similarly, if you want the element name to be dynamic and change, this will
also change its ID and cause it to malfunction. In this case, you can use 3
consecutive "#" to determine an unique ID and ignore what's before it. So
the element named "Test1###id01" could have anything before the "#" that it
will still work as expected.

Functions13
def cave.ui.button(title: str)-> bool

A Clickable Button. Returns True on click.

def cave.ui.buttonDark(title: str)-> bool

A Clickable, Full Height and Width, Button. Returns True on click.

def cave.ui.getActiveEntity()-> cave.Entity
def cave.ui.header(title: str)-> bool

Creates a collapsable Header, returns True if it's open, False otherwise.

def cave.ui.prop(name: str,prop: bool)-> bool
def cave.ui.prop(name: str,prop: int)-> int
def cave.ui.prop(name: str,prop: float)-> float
def cave.ui.prop(name: str,prop: cave.Vector2)-> cave.Vector2
def cave.ui.prop(name: str,prop: cave.Vector3)-> cave.Vector3
def cave.ui.prop(name: str,prop: str)-> str
def cave.ui.propSlider(name: str,prop: int,rMin: float = 0.0,rMax: float = 0.0)-> int
def cave.ui.propSlider(name: str,prop: float,rMin: float = 0.0,rMax: float = 0.0)-> float
def cave.ui.propSlider(name: str,prop: cave.Vector2,rMin: float = 0.0,rMax: float = 0.0)-> cave.Vector2
def cave.ui.propSlider(name: str,prop: cave.Vector3,rMin: float = 0.0,rMax: float = 0.0)-> cave.Vector3
def cave.ui.separator()

Creates a horizontal, full width, line to separate subjects.

def cave.ui.setActiveEntity(entity: cave.Entity)
def cave.ui.text(text: str)

Writes a Text to the UI

def cave.ui.textInfo(text: str)
def cave.ui.textWarning(text: str)
def cave.ui.treeNodeEnd()
def cave.ui.treeNodeStart(title: str)-> bool
Classes1
Class

DebugTab

cave.ui.DebugTab

A DebugTab can be extended and registered as a Cave Editor Tab.

Attributes1
active: bool
Constructors1
def __init__()
Methods1
def draw()

This is called every frame when the Tab is active, use it to update its look using the immediate mode cave.ui API.