-
-
Notifications
You must be signed in to change notification settings - Fork 183
Release notes version 0.0.8
Previously the BF BGE and UPBGE was loosing input events if the framerate was low. To fix this issue a major refactor was needed.
With the refactor, all inputs are represented by a python proxy name SCA_InputEvent
.
This input class give access to every status of the key from the last frame:
input.status
Which mean that if the input is pressed and released just after the list will contains [0, 2, 0]
. Else if the input is release and pressed again : [2, 0, 2]
(Asuming 2 is bge.logic.KX_INPUT_ACTIVE).
For the user, checking if a input was active is done by the condition:
if bge.logic.KX_INPUT_ACTIVE in input.status:
pass # Do something
The status
list always contains one value and the first value is the last value of the same list the last frame.
The input class also expose the events received for the given input:
input.queue
In the same example if the input is pressed and released the list will contains [1, 3]
. In the reverse case it will be : [3, 1]
(Asuming 1 is bge.logic.KX_INPUT_JUST_ACTIVATED and 3 bge.logic.KX_INPUT_JUST_RELEASED).
For the user, checking if a input is pressed or released is done by the condition:
if bge.logic.KX_INPUT_JUST_ACTIVATED in input.queue:
pass # Input pressed
if bge.logic.KX_INPUT_JUST_RELEASED in input.queue:
pass # Input released
The queue
list can be empty.
The final list exposed in the input class is about values of the input:
input.values
This list is useful only for movement mouse inputs. For example to detect the movement speed of the mouse wheel:
import bge
speed = bge.logic.mouse.inputs[bge.events.WHEELUPMOUSE].values[0]
This same list can also be used to detect every position the mouse covered. As status
, queue
always contains one value and the first value is the last value of the same list the last frame.
The input class is get from the keyboard class or mouse class:
# For keyboard
keyboard.inputs
keyboard.activeInputs
#For mouse
mouse.inputs
The old keyboard.events
, keyboard.active_events
and mouse.events
are kept for compatibility but strongly deprecated as the conversion for compatibility is not perfect.
See also: SCA_InputEvent, SCA_PythonKeyboard and SCA_PythonMouse.
The user is now able to control the lods in game. He can replace a list of lod and apply a factor to the distance used for lod.
First, the list of lod is accessible in a lod manager (KX_LodManager
) from KX_GameObject
:
gameobj.lodManager
In this lod manager, the user can read all lod infos from KX_LodLevel
accesible from:
lodManager.levels
The KX_LodLevel
class expose attributs:
lodLevel.mesh
lodLevel.level
lodLevel.distance
lodLevel.hysteresis
lodLevel.useHysteresis
lodLevel.useMesh
lodLevel.useMaterial
Secondly the distance used to compute lod can be multiplied by a factor in KX_Camera
and in KX_LodManager
:
lodManager.distanceFactor
camera.lodDistanceFactor
The both factor are applied to the lod distance.
See also: KX_LodManager and KX_LodLevel.
Is now possible to the user to access to the game object bouding box via KX_BoundingBox
. This bounding box class allow the user to modify the min
and max
of the box and allow auto update.
The bounding box is get from:
gameobj.cullingBox
And expose attributs:
box.min
box.max
box.radius
box.center
box.autoUpdate
It's advised to set autoUpdate
to False
before alterate min
and max
.
See also: KX_BoundingBox.
VAO are now used in render if the user select VBO. This improvement speedup of 16% the material switch during render.
The function KX_2DFilter.setTexture
now allow the user to pass the sampler name to avoid the call to setSampler
in the user side. The samplerName
argument is optional to leave the user change a texture bindcode.
filter.setTexture(0, texture.bindCode, "textureDiffuse")
# Instead of:
filter.setTexture(0, texture.bindCode)
filter.setSampler("textureDiffuse", 0)
See also: KX_2DFilter.setTexture.
The "Show Bounding Box" debug option now draw the center of the bounding box.