「利用者:Moguri/BGE Collision API Proposal」の版間の差分
(Created page with "=BGE Collision API= I don't yet know whether to use an event list or callbacks. ==CollisionEvent objects== Properties: * location * material * object (These I would like to i...") |
細 (1版 をインポートしました) |
(相違点なし)
|
2018年6月29日 (金) 04:42時点における最新版
BGE Collision API
I don't yet know whether to use an event list or callbacks.
CollisionEvent objects
Properties:
- location
- material
- object
(These I would like to include)
- normal
- force
CollisionEvent list
Stored on KX_GameObjects. For each collision, two events are created and one is stored on each KX_GameObject in the collision.
Example:
for ce in obj.collisions: if ce.name == "Bomb": obj.endObject()
Collision callbacks
Collision callbacks are registered on KX_GameObjects. The callback functions take a KX_GameObject and a CollisionEvent object and do not return anything.
Example:
def col_bomb(self, ce): if ce.object.name == "Bomb": self.endObject() obj.register(col_bomb)