I have created an animation that works perfectly with alt+A. I tried to use actuators and a script to make it work in bge, but everytime I run it the plane disappears. Here is the blend file.
If you move the mouse, the 3 arrows follow the cursor. When you right click on the ground plane, the animation should have taken place. It does not. Instead the ground plane disappears leaving behind a small green line.
Here is the module code:
#Import the bge library. import bge #Make the mouse cursor visible during game running time. bge.render.showMouse(True) #Set the current game scene and python controller to variables. scene = bge.logic.getCurrentScene() cont = bge.logic.getCurrentController() #The function "initialization" is responsible for setting all scene objects, object sensors and object actuators to variables. #These variables are created into the function but are for global use. Their names are the names of the objects/sensors/actuators in blender. def initialization(): for k in scene.objects: exec("globals()[\"%s\"]=scene.objects[\"%s\"]"%(k,k)) for k in ground.sensors: exec("globals()[\"%s\"]=ground.sensors[\"%s\"]"%(k,k)) for k in cont.actuators: exec("globals()[\"%s\"]=cont.actuators[\"%s\"]"%(k,k)) #The function "empty_to_pos" gives the cursor_empty coordinates on the ground. def empty_to_pos(): cursor_empty.worldPosition = (mop.hitPosition,mop.hitPosition,ground.worldPosition.z) #The function "cursor_anim" is responsible for the start and end of the cursor animation. def cursor_anim(): cont.activate(anim_arrow_1) cont.activate(anim_arrow_5) cont.activate(anim_arrow_9) initialization() empty_to_pos() if (right_click.positive): cursor_anim() print ("I reached the end of track.py")
and an image:
Any ideas why the animation is not working and why the plane disappears? Thanks