Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2011-07-08 10:51:12 +0400
committerDalai Felinto <dfelinto@gmail.com>2011-07-08 10:51:12 +0400
commit936737b70fc6b44411c0f03dd5acc1eb23777b5b (patch)
treeb4a86799de8f692c8c8a54135a0a1b12b211ec87
parent357afe06bc9964291ef0a7e56031a260646e36cf (diff)
example of Physics Constraints module :)
+ some small fixes in other docs. A topic for later(soon?), I think we should name the modules according to the rest of Blender modules. So instead of: Game Engine bge.logic Module We would have it: Game Logic (bge.logic) ...
-rw-r--r--doc/python_api/examples/bge.constraints.py37
-rw-r--r--doc/python_api/examples/bge.texture.1.py3
-rw-r--r--doc/python_api/examples/blf.py1
-rw-r--r--doc/python_api/rst/bge.events.rst2
4 files changed, 39 insertions, 4 deletions
diff --git a/doc/python_api/examples/bge.constraints.py b/doc/python_api/examples/bge.constraints.py
new file mode 100644
index 00000000000..4cd967310cc
--- /dev/null
+++ b/doc/python_api/examples/bge.constraints.py
@@ -0,0 +1,37 @@
+"""
+Basic Physics Constraint
+++++++++++++++++++++++
+Example of how to create a hinge Physics Constraint between two objects.
+"""
+from bge import logic
+from bge import constraints
+
+# get object list
+objects = logic.getCurrentScene().objects
+
+# get object named Object1 and Object 2
+object_1 = objects["Object1"]
+object_2 = objects["Object2"]
+
+# want to use Edge constraint type
+constraint_type = 2
+
+# get Object1 and Object2 physics IDs
+physics_id_1 = object_1.getPhysicsId()
+physics_id_2 = object_2.getPhysicsId()
+
+# Use bottom right edge of Object1 for hinge position
+edge_position_x = 1.0
+edge_position_y = 0.0
+edge_position_z = -1.0
+
+# use Object1 y axis for angle to point hinge
+edge_angle_x = 0.0
+edge_angle_y = 1.0
+edge_angle_z = 0.0
+
+# create an edge constraint
+constraints.createConstraint( physics_id_1, physics_id_2,
+ constraint_type,
+ edge_position_x, edge_position_y, edge_position_z,
+ edge_angle_x, edge_angle_y, edge_angle_z )
diff --git a/doc/python_api/examples/bge.texture.1.py b/doc/python_api/examples/bge.texture.1.py
index 5b387c8659c..74b37e72994 100644
--- a/doc/python_api/examples/bge.texture.1.py
+++ b/doc/python_api/examples/bge.texture.1.py
@@ -5,7 +5,6 @@ Example of how to replace a texture in game with an external image.
createTexture() and removeTexture() are to be called from a module Python
Controller.
"""
-import bge
from bge import logic
from bge import texture
@@ -14,7 +13,7 @@ def createTexture(cont):
object = cont.owner
# get the reference pointer (ID) of the internal texture
- ID = VT.materialID(obj, 'IMoriginal.png')
+ ID = texture.materialID(obj, 'IMoriginal.png')
# create a texture object
object_texture = texture.Texture(object, ID)
diff --git a/doc/python_api/examples/blf.py b/doc/python_api/examples/blf.py
index c91b41bec36..3ab7f789ce8 100644
--- a/doc/python_api/examples/blf.py
+++ b/doc/python_api/examples/blf.py
@@ -5,7 +5,6 @@ Blender Game Engine example of using the blf module. For this module to work we
need to use the OpenGL wrapper :class:`~bgl` as well.
"""
# import game engine modules
-import bge
from bge import render
from bge import logic
# import stand alone modules
diff --git a/doc/python_api/rst/bge.events.rst b/doc/python_api/rst/bge.events.rst
index 7215902a828..cc76ecded85 100644
--- a/doc/python_api/rst/bge.events.rst
+++ b/doc/python_api/rst/bge.events.rst
@@ -1,5 +1,5 @@
-Game Engine bge.events module
+Game Engine bge.events Module
=============================
*****