3rd Person Telekinesis/Levitation Template Using Logic Bricks And MouseLook Script

This is a system where a 3rd person view character can lift an object from a distance while also simultaneously playing a telekinesis animation. Files are at the bottom.
W to walk forward
Left and right keys to turn
Tap Z to toggle telekinesis on and off (it is on when character raises hand)
Mouse to move object when telekinesis is on (vertical movement for telekinesis is inverted)

I’d already set up movement and rotation, so thats another story for another thread. In my file, the crate I will be levitating is blue (AND MUST BE SET TO RIGID BODY PHYSICS), whereas my “telecube” is yellow. The “telecube” is the object name for the cube I placed in the centre of my player, then parented to the invisible movement cube (this is the cube, to which my armature is parented, which has all my movement logic bricks set up to it. The cube moves, the whole player, armature, and telecube move as well. Again, another story for another thread.) It looks better if the telecube isn’t visible during gameplay so I toggled “Invisible” in the physics window of the telecube.
I used a mouselook script from riyuzakisan, then placed this in the scripts window. I then gave the telecube a mouse movement sensor connected to a python gate, where the script is then selected. If you run the game as it is like this,
when you move the mouse, the character will rotate and more importantly the telecube will spin on whichever axis you move the mouse in. Character will only rotate sideways which is a good thing. Character should not go upside down at all!

1.) THE MOVEMENT BOUND/BOX (Whatever is giving your character movement)

I gave my character’s movement box an integer property called lift set to 0. When I press “Z” key, and the movement box is near the crate (which has a property called “crate”), the property called lift is set to 1 by adding 1 to 0. When lift is 1, the movement cube sends a message to the telecube. If I press “Z” again, since I am still near the crate 1 is added to 1, to give 2. When lift is 2, a message is sent to the crate saying “end”, and lift is reset to 0.

2.) THE TELECUBE (PHYSICS MUST BE NO COLLISION, like everything else inside the movement box so it does not repel the movement box.)

When the telecube receives the message sent by the movement box (Mine said “lift” for simplicity), it will send a message to the crate (mine said “levitate”).

3.) THE CRATE (Whatever it is you are levitating)
When the crate receives the message “levitate”, it will then parent to the telecube (which has a mouselook script, remember.) Now if you run the game and press Z then move the mouse at this stage, the crate will move with the mouse. But if you press Z again, you notice the cube is still attached. I thus made so that when the crate receives the message “end” from the movement box, it will end parent and resume its physics.


I made an animation for the telekinesis, so that he raises his hand while continuing to breathe to levitate an object. The animation can be a single frame with the character’s arm up or may include breathing. Character’s arm must be up throughout the animation or whatever you want. What I mean to say is dont include frames which involve, for example, the character progressing from an idle stance or going back into an idle stance. Will not work properly since the animation will be looping. I gave my armature a boolean property called telekinesis set to False. When I press Z, telekinesis property is set to True. When telekinesis property is True, the action actuator activates (Loop Stop). When telekines property is True (meaning telekinesis is toggled on and active), and Z is pressed again (meaning you want to toggle telekinesis off) the property telekinesis is set to False again.

To improve, I’m sure the near sensor can be replaced with a ray sensor to avoid problems with multiple objects.
Hope I helped!
Files are below:
kinesisfinal.zip (390 KB)