To make it easier to work with lua-controller-scripts using
OgreKit.getCurrentController() you need some important functions that wasn't
implemented yet.
assuming cont is current controller:
1) Get the object this script is attached to:
obj = cont.getOwner()
2) Get a specific sensor / actuator that is connected to this controller:
sensor = cont.getSensor("name")
actuator = cont.getActuator("act");
3) Query if a sensor is activated (e.g. key-down)
isActive = sensor.isPositive()
4) Get LogicObject this controller is attached to:
logicObj = cont.getLogicObject()
5) Get/Set Properties that are connected to a gameobject:
x = obj.getProperty("x");
x.setProperty("x",95);
(This is actually only wrapping methods that are already available is
gsGameObject but somehow not available in lua __setitem__ etc. )
6) Send a message to the messageManager so that message-sensors are fired.
OgreKit.sendMessage(fromGameObjectName,toGameObjectName,subject,body)
e.g.
-- call all message-sensors that listen to the subject "left"
OgreKit.sendMessage("","","left","")
-- call the message-sensor of a specific gameobject with name "cube":
OgreKit.sendMessage("","cube","left","")
More functions to come. Feel free to c++-ify the code! I'm not sure if I used
all convetioned. Not so used to c++ yet.
PS: I have absolutely now clue how to control the issue-type as this is more a
feature-request...
Original issue reported on code.google.com by thomas.t...@googlemail.com on 24 Oct 2011 at 1:35
Original issue reported on code.google.com by
thomas.t...@googlemail.com
on 24 Oct 2011 at 1:35Attachments: