Allow extensions relying on the 3D physics to customize its behavior a bit.

Hierarchy (view full)

Implements

Constructors

Properties

Methods

abortJump activate activated canJump doBeforePhysicsStep doStepPostEvents doStepPreEvents enableSynchronization getCurrentFallSpeed getCurrentForwardSpeed getCurrentJumpSpeed getCurrentSidewaysSpeed getForwardAcceleration getForwardAngle getForwardDeceleration getForwardSpeedMax getGravity getJumpSpeed getJumpSpeedToReach getJumpSustainTime getMaxFallingSpeed getName getNameId getNetworkSyncData getPhysics3D getPhysicsPosition getPhysicsRotation getSidewaysAcceleration getSidewaysDeceleration getSidewaysSpeedMax getSlopeMaxAngle getStairHeightMax getStickAngle getStickForce isFalling isFallingWithoutJumping isForwardAngleAround isJumping isMovingEvenALittle isOnFloor isOnFloorObject isSyncedOverNetwork moveObjectToPhysicsPosition moveObjectToPhysicsRotation onActivate onCreated onDeActivate onDestroy onObjectHotReloaded setCanJump setCanNotAirJump setCurrentFallSpeed setCurrentForwardSpeed setCurrentJumpSpeed setCurrentSidewaysSpeed setForwardAcceleration setForwardAngle setForwardDeceleration setForwardSpeedMax setGravity setJumpSpeed setJumpSustainTime setMaxFallingSpeed setShouldBindObjectAndForwardAngle setSidewaysAcceleration setSidewaysDeceleration setSidewaysSpeedMax setSlopeMaxAngle setStairHeightMax shouldBindObjectAndForwardAngle simulateBackwardKey simulateForwardKey simulateJumpKey simulateLeftKey simulateRightKey simulateStick stepPostEvents stepPreEvents updateFromBehaviorData updateFromNetworkSyncData usesLifecycleFunction wasBackwardKeyPressed wasForwardKeyPressed wasJumpKeyPressed wasLeftKeyPressed wasRightKeyPressed wasStickUsed getAcceleratedSpeed getVec3 updateCharacterSpeedFromInputs updateGroundVelocity

Constructors

Properties

character: null | CharacterVirtual = null
charactersManager: CharactersManager

Handle collisions between characters that can push each other.

collisionChecker: CharacterCollisionChecker
name: string

The object owning the behavior

type: string
epsilon: number = ...

A very small value compare to 1 pixel, yet very huge compare to rounding errors.

Methods

  • Check if the Character is "going down", either because it's in the falling state or because it's jumping but reached the jump peak and is now going down (because the jump speed can't compensate anymore the falling speed).

    If you want to check if the object is falling outside of a jump (or because the jump is entirely finished and there is no jump speed applied to the object anymore), consider using isFallingWithoutJumping.

    Returns boolean

    Returns true if it is "going down" and false if not.

  • Reimplement this to do extra work when the behavior is created (i.e: an object using it was created), after the object is fully initialized (so you can use this.owner without risk).

    Returns void

  • Set the maximum falling speed of the Character.

    Parameters

    • maxFallingSpeed: number

      The maximum falling speed.

    • tryToPreserveAirSpeed: boolean = false

      If true and if jumping, tune the current jump speed to preserve the overall speed in the air.

    Returns void

  • Called when the behavior must be updated using the specified behaviorData. This is the case during hot-reload, and is only called if the behavior was modified.

    Parameters

    • oldBehaviorData: any

      The previous data for the behavior.

    • newBehaviorData: any

      The new data for the behavior.

    Returns boolean

    true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).

    See

    gdjs.RuntimeBehavior#onObjectHotReloaded

  • Should return false if the behavior does not need any lifecycle function to be called. Default, hidden, "capability" behaviors set it to false. This avoids useless calls to empty lifecycle functions, which would waste CPU time (and have a sizeable impact for example when lots of static instances are living in the scene).

    Returns boolean