Im getting the error that “W = cont.sensors…” is calling for an object that is not callable, any help? im trying to learn python, by making examples. it is quite hard to get some good explanation on how the game engine works, thank god i understand how it works. sorta.
def move():
cont = GameLogic.getCurrentController() # this can be avoided, see run_2
W = cont.sensors('w_bla')
A = cont.sensors('a_bla')
speed = 120
force = [0.0, 0.0, 0.0, 0]
if w.positive:
force[1] += SPEED
if s.positive:
force[1] += (SPEED * -1)
if a.positive:
force[0] += (SPEED * -1)
if d.positive:
force[0] += SPEED
print force
any help would be appreciated, and yes this code is from nanoshooter.
this will tell you what you can do to manipulate the actuators properties.
just play around with the dir(), its incredibly useful for debugging
…and have fun
Thank you all for replying, i have another question now:
I have a cube, which i move around with servo, well big whoop nothing fancy there, but i have a camera which has the cube as a parent, when the cube moves/rotates I do not want the camera to rotate with it… how do i do that?
to vertex parent an object to another just get into the parents edit mode, select one OR three vertices then shift+click the child and press strg+p once both the vertex and the child object are outlined.
Now for maybe a more advanced question, As i am trying to learn i want the cube in the center of the screen to be facing exactly where my mouse is, i have made it so that i have 2 variables : x, y that give off the position of the mouse in proportion to where my cube is
any way to make the cube rotate towards the mouse?