-
-
Notifications
You must be signed in to change notification settings - Fork 183
0.0.6
It's now possible for the user to simply replace the physics shape of an object by the one contained in an other object with:
obj1.replacePhysicsShape(obj2)
The physics shape from obj2
will be set to obj1
Also as the bge.logic.LibNew
python function allow the user to duplicate a mesh, it's now possible to duplicate the physics mesh shape for this new mesh with:
obj2.reinstancePhysicsMesh(obj, mesh, dupli)
The dupli argument allow the user to duplicate the physics shape and then update it with the first and second argument.
See also: KX_GameObject.replacePhysicsShape
and KX_GameObject.reinstancePhysicsMesh
The user can now modify the material ambient factor and the material specular alpha with:
material.ambient = float
material.specularAlpha = float
See also: KX_BlenderMaterial.ambient
and KX_BlenderMaterial.specularAlpha
The steering actuator path computed for this frame (or every X frame with pathUpdatePeriod) is now accesible with:
KX_SteeringActuator.path
The path is a list of Vector of each point. See also: KX_SteeringActuator.path
To check if a scene exists and then can be added with bge.logic.addScene, the following list is used:
bge.logic.getInactiveSceneNames()
This function return a list of name of all scenes not added (equivalent to not found in bge.logic.getSceneList()
).
See also: getInactiveSceneNames
The game object can now be renamed, the user have to simply set the name:
object.name = "NewName"
The object will be renamed to "NewName", also objects that was not added in game can be used with theirs new names:
scene.addObject("NewName")
The collision contact points are now accesible in the form of a list in the python collision callback KX_GameObject.collisionCallbacks
. The point list is passed to the fourth argument because of compatibility.
Each item of the list provide the following attributs:
point.localPointA
point.localPointB
point.worldPoint
point.normal
point.combinedFriction
point.combinedRestitution
point.appliedImpulse
See also: KX_CollisionContactPoint
The user can now acces to all eight UV channels thanks to vertex.uvs
where uvs
is a list of eight Vectors. See also: KX_VertexProxy.uvs
To know if a light is an hemi lamp, the enum KX_LightObject.HEMI
is returned by light.type
. See also: KX_LightObject.HEMI
Python textures
A new python class BL_Texture
allow the user to modify the texture influence to the material. The attributes accesible are:
texture.diffuseIntensity
texture.diffuseFactor
texture.alpha
texture.specularAlpha
texture.specularIntensity
texture.speculatFactor
texture.hardness
texture.emit
texture.mirror
texture.normal
texture.parallaxBump
texture.parallaxStep
texture.lodBias
texture.bindCode
These textures are available in KX_BlenderMaterial
in a list by index and name:
materials.textures
materials.textures[0]
materials.textures["colorMap"]
See also: BL_Texture
The lod bias is now moved from texture to per material texture. The option is displayed in texture panel:
Same as before with a negative value the texture will look like there's no mipmapping and a positive value will blured the texture. See also: BL_Texture.lodBias
The user can now optimize some material values by making them not updated every frame. The categories are: Material, Texture, Lamp, World and Mist. The user can choose what group of value to make constant in material UI:
The constants value can optimize of 25% the rendering time.
The @Moguri's feature about python component is now updated and refactored for the UPBGE. It allow the user to make itself kind of logic bricks from python. He just have to defines the properties with a dictionary args and two callbacks functions : start(args)
and update()
.
All the components are accesible from the game object with:
gameobject.components[0]
gameobject.components["ThirdPerson"]
Example of third person python component, it only move and rotate the owner object when pressing W, S, A or D.
import bge
from collections import OrderedDict
class ThirdPerson(bge.types.KX_PythonComponent):
"""Basic third person controls
W: move forward
A: turn left
S: move backward
D: turn right
"""
#
args = OrderedDict([
("Move Speed", 0.1),
("Turn Speed", 0.04),
])
def start(self, args):
self.move_speed = args['Move Speed']
self.turn_speed = args['Turn Speed']
def update(self):
keyboard = bge.logic.keyboard.events
move = 0
rotate = 0
if keyboard[bge.events.WKEY]:
move += self.move_speed
if keyboard[bge.events.SKEY]:
move -= self.move_speed
if keyboard[bge.events.AKEY]:
rotate += self.turn_speed
if keyboard[bge.events.DKEY]:
rotate -= self.turn_speed
self.object.applyMovement((0, move, 0), True)
self.object.applyRotation((0, 0, rotate), True)
ThirdPerson component from UI:
The property types supported are showed in:
See also: KX_PythonComponent
- Compilation without python (see #35c8c6a, #aa2a2a8, #f124b85)
- Replace MT_assert by BLI_assert (see #ea6ff7d)
- Thread lock classes (see #54e60b8)
- Increase max UV layer in transformUV (see #387a731)
- Use KX_GameObject::GetScene instead of KX_GetActiveScene (see #3484d2f)
- Cleanup
KX_MotionState.[h/cpp]
(see #97c7ba1) - Refactor rasterizer opengl call (see #2f981e5)
- Restore background API for retrocompatibility (see #b9069c4)
- Fix unbinded primitives after unset material (see #30503d5)
- Fix T48099: None accepted in getScreenPosition (see #1883449)
- Fix timer documentation (see #368d752)
- Fix unfreed mesh in KX_GameObject (see #976eb34)