KX GameObject
Wikipedia,自由的百科全书
游戏物体模块
Class KX_GameObject
游戏物体类
Known Subclasses:
需要的子集
KX_Camera, KX_Light
________________________________________
All game objects are derived from this class. 所有的游戏物体都源自这个类。
Properties assigned to game objects are accessible as attributes of this class. 道具赋值给游戏物体都受到这个类的属性影响
________________________________________
Method Summary 函数概要
applyImpulse(point, impulse)
Applies an impulse to the game object.应用一个推动力到游戏物体
disableRigidBody()
Disables rigid body physics for this object.关闭物体的刚体物理学
enableRigidBody()
Enables rigid body physics for this object.打开物体的刚体物理学 list [vx, vy, vz] getLinearVelocity() Gets the game object's linear velocity. 得到游戏物体的线性速度 float getMass() Gets the game object's mass.得到游戏物体的质量 KX_MeshProxy getMesh(mesh) Gets the mesh object for this object.得到游戏物体的网格 3x3 rotation matrix 3x3旋转矩阵 getOrientation() Gets the game object's orientation. 得到游戏物体的方向 KX_GameObject getParent() 得到游戏物体的父类 Gets this object's parent.
getPhysicsId()
Returns the user data object associated with this game object's physics controller.返回用户物体数据相关联的游戏物体的物理学控制器 list [x, y, z] getPosition() Gets the game object's position.得到游戏物体的位置 list [fx, fy, fz] getReactionForce() Gets the game object's reaction force.得到游戏物体的反作用力 list [vx, vy, vz] getVelocity(point) Gets the game object's velocity at the specified point.在指定的点上得到游戏物体的速度
restoreDynamics()
Resumes physics for this object.在物体上恢复物理学
setOrientation(orn)
Sets the game object's orientation.设置游戏物体的方位
setPosition(pos)
Sets the game object's position. 设置游戏物体的位置
setVisible(visible)
Sets the game object's visible flag. 设置游戏物体的可见标志
suspendDynamics()
Suspends physics for this object. 挂起物体的物理学
Instance Variable Summary 实参概要
float mass: The object's mass (provided the object has a physics controller).
物体的质量(假如这个物体有一个物理控制器)
string. name: The object's name. 物体名字
3x3 Matrix float orientation: The object's orientation. 物体的方向
KX_GameObject parent: The object's parent object. 物体的父类
list [x, y, z] position: The object's position. 物体的位置
list [sx, sy, sz] scaling: The object's scaling factor. 物体缩放比例因数
boolean visible: visibility flag. 可见标志
Method Details 函数详细资料
applyImpulse(point, impulse) Applies an impulse to the game object. This will apply the specified impulse to the game object at the specified point. If point != getPosition(), applyImpulse will also change the object's angular momentum. Otherwise, only linear momentum will change. 应用游戏物体指定的推动力在指定的点上。如果指定点不等于当前点,物体的角动力也会改变,否则,只有线动力改变。 Parameters: point - the point to apply the impulse to (in world coordinates)
(type=list [x, y, z])
disableRigidBody() Disables rigid body physics for this object.
enableRigidBody() Enables rigid body physics for this object. Rigid body physics allows the object to roll on collisions. 刚体物理允许物体滚动碰撞
getLinearVelocity() Gets the game object's linear velocity. This method returns the game object's velocity through it's centre of mass, ie no angular velocity component. cf getVelocity() Returns: the object's linear velocity.
(type=list [vx, vy, vz])
getMass() Gets the game object's mass. Returns: the object's mass.
(type=float)
getMesh(mesh) Gets the mesh object for this object. Parameters: mesh - the mesh object to return (optional: default mesh = 0)
(type=integer)
Returns: the first mesh object associated with this game object, or None if this object has no meshs.
(type=KX_MeshProxy)
getOrientation()
Gets the game object's orientation.
Returns:
The game object's rotation matrix
(type=3x3 rotation matrix)
getParent() Gets this object's parent. Returns: this object's parent object, or None if this object has no parent.
(type=KX_GameObject)
getPhysicsId()
Returns the user data object associated with this game object's physics controller.
getPosition() Gets the game object's position. Returns: the object's position in world coordinates.
(type=list [x, y, z])
getReactionForce() Gets the game object's reaction force. The reaction force is the force applied to this object over the last simulation timestep. This also includes impulses, eg from collisions. Returns: the reaction force of this object.
(type=list [fx, fy, fz])
getVelocity(point) Gets the game object's velocity at the specified point. Gets the game object's velocity at the specified point, including angular components. Parameters: point - the point to return the velocity for, in local coordinates. (optional: default = [0, 0, 0])
(type=list [x, y, z])
Returns: the velocity at the specified point.
(type=list [vx, vy, vz])
restoreDynamics() Resumes physics for this object.
setOrientation(orn) Sets the game object's orientation. Parameters: orn - a rotation matrix specifying the new rotation.
(type=3x3 rotation matrix, or Quaternion.)
setPosition(pos) Sets the game object's position. Parameters: pos - the new position, in world coordinates.
(type=[x, y, z])
setVisible(visible) Sets the game object's visible flag. Parameters: visible
(type=boolean)
suspendDynamics() Suspends physics for this object.
Instance Variable Details 实参详细资料
mass The object's mass (provided the object has a physics controller). Read only. Type: float
name The object's name. Type: string.
orientation The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. Type: 3x3 Matrix float
parent The object's parent object. (Read only) Type: KX_GameObject
position
The object's position.
Type:
list [x, y, z]
scaling The object's scaling factor. list [sx, sy, sz] Type: list [sx, sy, sz]
visible visibility flag. Type: boolean
