Browse Source

Change physisc.set_listener to set_event_listener

Björn Ritzl 1 month ago
parent
commit
0886dc4fc6

+ 5 - 5
docs/en/manuals/physics-events.md

@@ -1,11 +1,11 @@
 ---
 ---
 title: Collision events in Defold
 title: Collision events in Defold
-brief: Collision event handling can be centralized by using `physics.set_listener()` to direct all collision and interaction messages to a single specified function.
+brief: Collision event handling can be centralized by using `physics.set_event_listener()` to direct all collision and interaction messages to a single specified function.
 ---
 ---
 
 
 # Defold Physics Event Handling
 # Defold Physics Event Handling
 
 
-Previously, physics interactions in Defold were handled by broadcasting messages to all components of colliding objects. However, starting with version 1.6.4, Defold offers a more centralized approach through the `physics.set_listener()` function. This function allows you to set a custom listener to handle all physics interaction events in one place, thereby streamlining your code and improving efficiency.
+Previously, physics interactions in Defold were handled by broadcasting messages to all components of colliding objects. However, starting with version 1.6.4, Defold offers a more centralized approach through the `physics.set_event_listener()` function. This function allows you to set a custom listener to handle all physics interaction events in one place, thereby streamlining your code and improving efficiency.
 
 
 ## Setting the Physics World Listener
 ## Setting the Physics World Listener
 
 
@@ -19,7 +19,7 @@ Here is an example of how to set a physics world listener within a collection pr
 function init(self)
 function init(self)
     -- Assuming this script is attached to a game object within the collection loaded by the proxy
     -- Assuming this script is attached to a game object within the collection loaded by the proxy
     -- Set the physics world listener for the physics world of this collection proxy
     -- Set the physics world listener for the physics world of this collection proxy
-    physics.set_listener(physics_world_listener)
+    physics.set_event_listener(physics_world_listener)
 end
 end
 ```
 ```
 
 
@@ -101,7 +101,7 @@ local function physics_world_listener(self, event, data)
 end
 end
 
 
 function init(self)
 function init(self)
-    physics.set_listener(physics_world_listener)
+    physics.set_event_listener(physics_world_listener)
 end
 end
 ```
 ```
 
 
@@ -132,6 +132,6 @@ function on_message(self, message_id, message)
 end
 end
 
 
 function init(self)
 function init(self)
-    physics.set_listener(physics_world_listener)
+    physics.set_event_listener(physics_world_listener)
 end
 end
 ```
 ```

+ 1 - 1
docs/en/manuals/physics-messages.md

@@ -20,7 +20,7 @@ When two collision objects interact, we check if we should send a message to the
 
 
 E.g. given the "Generate Contact Events" checkboxes:
 E.g. given the "Generate Contact Events" checkboxes:
 
 
-When using `physics.set_listener()`:
+When using `physics.set_event_listener()`:
 
 
 | Component A | Component B | Send Message |
 | Component A | Component B | Send Message |
 |-------------|-------------|--------------|
 |-------------|-------------|--------------|

+ 1 - 1
docs/ru/manuals/physics-messages.md

@@ -20,7 +20,7 @@ brief: Когда два объекта сталкиваются, движок 
 
 
 Например, с флажками "Generate Contact Events":
 Например, с флажками "Generate Contact Events":
 
 
-Если используется `physics.set_listener()`:
+Если используется `physics.set_event_listener()`:
 
 
 | Компонент A | Компонент B | Отправить сообщение |
 | Компонент A | Компонент B | Отправить сообщение |
 |-------------|-------------|----------------------|
 |-------------|-------------|----------------------|

+ 5 - 5
docs/zh/manuals/physics-events.md

@@ -1,11 +1,11 @@
 ---
 ---
 title: Defold 中的碰撞事件
 title: Defold 中的碰撞事件
-brief: 可以通过使用 `physics.set_listener()` 将碰撞事件处理集中化,将所有碰撞和交互消息定向到单个指定函数。
+brief: 可以通过使用 `physics.set_event_listener()` 将碰撞事件处理集中化,将所有碰撞和交互消息定向到单个指定函数。
 ---
 ---
 
 
 # Defold 物理事件处理
 # Defold 物理事件处理
 
 
-以前,Defold 中的物理交互是通过向碰撞对象的所有组件广播消息来处理的。然而,从版本 1.6.4 开始,Defold 通过 `physics.set_listener()` 函数提供了一种更集中的方法。此函数允许您设置一个自定义监听器来在一个地方处理所有物理交互事件,从而简化代码并提高效率。
+以前,Defold 中的物理交互是通过向碰撞对象的所有组件广播消息来处理的。然而,从版本 1.6.4 开始,Defold 通过 `physics.set_event_listener()` 函数提供了一种更集中的方法。此函数允许您设置一个自定义监听器来在一个地方处理所有物理交互事件,从而简化代码并提高效率。
 
 
 ## 设置物理世界监听器
 ## 设置物理世界监听器
 
 
@@ -19,7 +19,7 @@ brief: 可以通过使用 `physics.set_listener()` 将碰撞事件处理集中
 function init(self)
 function init(self)
     -- 假设此脚本附加到代理加载的集合中的游戏对象上
     -- 假设此脚本附加到代理加载的集合中的游戏对象上
     -- 为此集合代理的物理世界设置物理世界监听器
     -- 为此集合代理的物理世界设置物理世界监听器
-    physics.set_listener(physics_world_listener)
+    physics.set_event_listener(physics_world_listener)
 end
 end
 ```
 ```
 
 
@@ -101,7 +101,7 @@ local function physics_world_listener(self, event, data)
 end
 end
 
 
 function init(self)
 function init(self)
-    physics.set_listener(physics_world_listener)
+    physics.set_event_listener(physics_world_listener)
 end
 end
 ```
 ```
 
 
@@ -132,6 +132,6 @@ function on_message(self, message_id, message)
 end
 end
 
 
 function init(self)
 function init(self)
-    physics.set_listener(physics_world_listener)
+    physics.set_event_listener(physics_world_listener)
 end
 end
 ```
 ```

+ 1 - 1
docs/zh/manuals/physics-messages.md

@@ -20,7 +20,7 @@ brief: 当两个对象碰撞时,引擎将调用事件回调或广播消息。
 
 
 例如,给定"生成接触事件"复选框:
 例如,给定"生成接触事件"复选框:
 
 
-当使用 `physics.set_listener()` 时:
+当使用 `physics.set_event_listener()` 时:
 
 
 | 组件 A | 组件 B | 发送消息 |
 | 组件 A | 组件 B | 发送消息 |
 |---------|---------|----------|
 |---------|---------|----------|