Skip to content

Commit

Permalink
VPRN: more clarification in the code example and in the XML configura…
Browse files Browse the repository at this point in the history
…tion changes

* callback functions need to be nested in the Processor class
* xml section nested under plugins
  • Loading branch information
dfelinto committed Feb 9, 2015
1 parent 2a11d26 commit a6116cc
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions manual/components/vrpn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ Example with a Nintendo Wii Controller
.. code:: xml
<processor>
<vrpn>
<analog name="WiiMote0" host="<vrpnServer@>" processor_method="wiiAnalog"/>
<button name="WiiMote0" host="<vrpnServer@>" processor_method="wiiButton"/>
</vrpn>
(...)
<plugins>
<vrpn>
<analog name="WiiMote0" host="localhost" processor_method="wiiAnalog"/>
<button name="WiiMote0" host="localhost" processor_method="wiiButton"/>
</vrpn>
</plugins>
</processor>
*Analog will receive accelerometer data from the WiiMote, button only the pressed button states.*
Expand All @@ -56,11 +59,19 @@ Example with a Nintendo Wii Controller

.. code:: python
def wiiAnalog(self, info):
print ("Analog from Wii through VPRN ", info)
import blendervr
def wiiButton(self, info):
print ("Button from Wii through VPRN ", info)
if blendervr.is_virtual_environment():
import bge
class Processor(blendervr.processor.getProcessor()):
(...)
def wiiAnalog(self, info):
print ("Analog from Wii through VPRN ", info)
def wiiButton(self, info):
print ("Button from Wii through VPRN ", info)
Here, both functions will be executed whenever the VRPN server receives data from the
WiiMote (the wiiButton when your touch a button, the wiiAnalog when you move the
Expand Down

0 comments on commit a6116cc

Please sign in to comment.