Mouse Pointer Lock
This behavior removes the limit on the distance the mouse can move and hides the cursor.
Authors and contributors to this experimental extension: PANDAKO, D8H.
This behavior removes the limit on the distance the mouse can move and hides the cursor.
For example, a user can rotate or continue to manipulate an object by moving the mouse endlessly (open the project online). Without the pointer lock, the rotation or operation will stop the moment the pointer reaches the edge of the browser or screen.
Game players don't have to worry about leaving the gameplay area or accidentally clicking on another application that moves the mouse focus away from the game.
Locking the pointer locks CursorX()
and CursorY()
expressions.
Use MovementX()
and MovementY()
instead.
Tip
Learn how to install new extensions by following a step-by-step guide.
Actions
Exit pointer lock
Unlocks the mouse pointer and show it.
See parameters
Technical note: parameters 0, 1 are internal parameters handled by GDevelop.
Request Pointer Lock
Lock the mouse pointer to hide it.
See parameters
Technical note: parameters 0, 1 are internal parameters handled by GDevelop.
Speed factor for touch movement
Change the speed factor for touch movement.
See parameters
- Parameter 1: 🟰 Operator
- Parameter 2 (🔢 Number): Value
Technical note: parameters 0, 3 are internal parameters handled by GDevelop.
Conditions
Locked pointer is moving
Check if the locked pointer is moving.
See parameters
Technical note: parameters 0, 1 are internal parameters handled by GDevelop.
Pointer X movement
Compare the movement of the locked pointer on the X axis.
See parameters
- Parameter 1: 🟰 Relational operator
- Parameter 2 (🔢 Number): Value to compare
Technical note: parameters 0, 3 are internal parameters handled by GDevelop.
Pointer Y movement
Compare the movement of the pointer on the Y axis.
See parameters
- Parameter 1: 🟰 Relational operator
- Parameter 2 (🔢 Number): Value to compare
Technical note: parameters 0, 3 are internal parameters handled by GDevelop.
Speed factor for touch movement
Compare the speed factor for touch movement.
See parameters
- Parameter 1: 🟰 Relational operator
- Parameter 2 (🔢 Number): Value to compare
Technical note: parameters 0, 3 are internal parameters handled by GDevelop.
Pointer is locked
Check if the mouse pointer is locked.
See parameters
Technical note: parameters 0, 1 are internal parameters handled by GDevelop.
Expressions
Expression | Description | |
---|---|---|
MousePointerLock::MovementX() |
Return the movement of the locked pointer on the X axis. | |
MousePointerLock::MovementY() |
Return the movement of the pointer on the Y axis. | |
MousePointerLock::TouchSpeedFactor() |
Return the speed factor for touch movement. |
First person camera mouse mapper
Control camera rotations with a mouse.
Behavior actions
Horizontal rotation speed factor
Change the horizontal rotation speed factor of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Operator
- Parameter 3 (🔢 Number): Value
Technical note: parameter 4 are internal parameters handled by GDevelop.
Z position offset
Change the z position offset of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Operator
- Parameter 3 (🔢 Number): Value
Technical note: parameter 4 are internal parameters handled by GDevelop.
Maximum vertical camera angle
Change the maximum vertical camera angle of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Operator
- Parameter 3 (🔢 Number): Value
Technical note: parameter 4 are internal parameters handled by GDevelop.
Minimum vertical camera angle
Change the minimum vertical camera angle of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Operator
- Parameter 3 (🔢 Number): Value
Technical note: parameter 4 are internal parameters handled by GDevelop.
Vertical rotation speed factor
Change the vertical rotation speed factor of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Operator
- Parameter 3 (🔢 Number): Value
Technical note: parameter 4 are internal parameters handled by GDevelop.
Behavior conditions
Horizontal rotation speed factor
Compare the horizontal rotation speed factor of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Relational operator
- Parameter 3 (🔢 Number): Value to compare
Technical note: parameter 4 are internal parameters handled by GDevelop.
Z position offset
Compare the z position offset of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Relational operator
- Parameter 3 (🔢 Number): Value to compare
Technical note: parameter 4 are internal parameters handled by GDevelop.
Maximum vertical camera angle
Compare the maximum vertical camera angle of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Relational operator
- Parameter 3 (🔢 Number): Value to compare
Technical note: parameter 4 are internal parameters handled by GDevelop.
Minimum vertical camera angle
Compare the minimum vertical camera angle of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Relational operator
- Parameter 3 (🔢 Number): Value to compare
Technical note: parameter 4 are internal parameters handled by GDevelop.
Vertical rotation speed factor
Compare the vertical rotation speed factor of the object.
See parameters
- Parameter 0: 👾 Object
- Parameter 1: 🧩 Behavior
- Parameter 2: 🟰 Relational operator
- Parameter 3 (🔢 Number): Value to compare
Technical note: parameter 4 are internal parameters handled by GDevelop.
Behavior expressions
Expression | Description | |
---|---|---|
Object.FirstPersonPointerMapper::HorizontalSpeed() |
Return the horizontal rotation speed factor of the object. | |
Object.FirstPersonPointerMapper::OffsetZ() |
Return the z position offset of the object. | |
Object.FirstPersonPointerMapper::VerticalAngleMax() |
Return the maximum vertical camera angle of the object. | |
Object.FirstPersonPointerMapper::VerticalAngleMin() |
Return the minimum vertical camera angle of the object. | |
Object.FirstPersonPointerMapper::VerticalSpeed() |
Return the vertical rotation speed factor of the object. |
This page is an auto-generated reference page about the Mouse Pointer Lock extension, made by the community of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop community-made extensions here.