Camera Based Movement (Analog Joystick or Keyboard)

I have created a camera-based joystick control for Blender 2.5x.

  1. The players alignment speed is adjustable.
  2. The camera can be rotated.
  3. The viewing angle can be adjusted and limited.
  4. The camera can be moved up to the object and limited.


Joystick control.blend (301 KB)

I like this camera system but it doesn’t seem to work if the logic from the cube is moved to an empty. Im trying to get it to work with this parent relationship.

Just a beginner with python but so far i changed,
pivot = o.children[0] to pivot = o.children[1] so it gets the right child.
pivot.worldOrientation is still spitting out strange values for the orientation matrix and i cant figure that one out, the result is the cube behaves uncontrollably. Is it possible to make it work this way?

I don’t know why you need that. For me that makes no sense. Normally you have to parent your animated player mesh in the cube and make the cube invisble.

But the reason why it is not working with an empty is, that I have used a vertex parented the cube to the CamRot. When you vertex parent a object the child is moving with the parent but it did not rotate with it.

I have made two three new examples:

  1. Joystick control 2.blend (304 KB)
    With a single vertex that you can parent to the player. The movement logic and the collision is running on the player.

  2. Joystick control 3.blend (305 KB)
    The vertex is parented to an empty. The movement logic and the collision is running on the empty. The player must be a ghost and a child of the empty.

  3. Joystick control 4.blend (296 KB)
    The player is parented to an empty by using a generic 6 DoF rigid body joint. The movement logic and the collision is running on the player. The CamRot must be rigid and ghost.

Hello I’m working with Stripey on the same project
His post is alittle hard to read because the text formatter changed it so I made a image that is hopefully more legible. Basicly what we want is to be ble to attach everything (eg: cams, scripts, phys…) to one main empty. This way we can just attach any character in our invintory to it and be able to play it. I have been playing with this myself but I have almost no scripting eperence in Blender …I’m just the artist :wink:


Joystick control 3.blend is the file that you need.

Thanks, we really appreciate your help with this.

how would i edit this so i can rotate a plane about its x and y axis, but the rotation value is equal to the joystick. basically nudge the joy slightly left, the plane rotates slightly left, but does not keep rotating. push the joy completely to the left, it rotates way left to the value of the joy, but does not keep rotating. let go of the joy, the plane resets to flat.

how can i do this?

Did you mean something like this?


AnalogJoystickPlane.blend (266 KB)

Great job HGI really great, thanks for sharing!!

Third person mouse look with keyboard control.

The old versions have a rotation problem with alignAxisToVect if the rotationspeed is lower then 0.5.
Keyboard control 1.blend (73.6 KB) old
Keyboard control 2.blend (74 KB) old with air movement.
Keyboard control 3.blend (74.4 KB) new (trak to aktuator) with air movement.