Ver código fonte

Update custom_controls.adoc

mitm001 8 anos atrás
pai
commit
5cce632894

+ 9 - 0
src/docs/asciidoc/jme3/advanced/custom_controls.adoc

@@ -21,3 +21,12 @@ For example, one NPC can be controlled by a PhysicsControl instance and an AICon
 **  You can pass arguments into your custom control.
 **  In the control class, the object `spatial` gives you access to the spatial and subspatials that the control is attached to.
 **  Here you modify the `spatial`'s transformation (move, scale, rotate), play animations, check its environement, define how it acts and reacts. 
+
+.  Add an instance of the Control to a spatial to give it this behavior. The spatial's game state is updated automatically from now on. +
+[source,java]
+----
+spatial.addControl(myControl);
+----
+
+
+To implement game logic for a type of spatial, you will either extend AbstractControl (most common case), or implement the Control interface, as explained in this article.