Prof. Monster's camera relative alignment/movement (1st draft)

Hi Blenderheads,

From time to time there are request how to establish character movement relative to the camera.
E.g. if the user presses left key the character turns left of the camera and moves into this direction.

Here is my first draft (2.63). Indeed it does not include fancy graphics but it works pretty well even if it is not very user friendly yet.

The demo uses the MouseOrbiter to orbit the camera around the character by mouse motion.
With <wasd> you can turn the character relative to the camera. The character will move forward as long as you hold any of these keys.

The blue arrow shows the direction of the camera.
The yellow arrow shows the direction you selected with keypress.

This method uses a mixture of parenting, trackTo and vertex-parent and does not use any Python.

(Python is used for mouse control only)

The setup is not that easy. I think I will improve that soon.



Camera-Relative-Alignment.blend (678 KB)

Really cool! Could you add a function to align the player with the camera but without any translation? (Just rotating on the z axis)

It already does. I just combined the rotation and the forward motion. If you disable forward motion only the rotation will remain.

AH ok! Thank you! Very useful!

monster I am wondering may I use your scripts for the movement in my own game? Also will you please help me understand the scripts you have written? I am in need of learning

Would there be anyway to apply this to an analogue joystick? But instead of only having the options of rotating to face four directions (forward(w), backward(s), left(a), and right(d)) is it possible to use the analogue joystick to perform a true full rotation?

For example, by circling the analogue joystick around we’d have the character perform a smooth rotation (on the Z axis). Another example, I would like to be able to flick the analogue joystick, say, 67 degrees and have the character rotate to face that 67 degree mark.

Any help would be much appreciated, if this is possible.

congratulations on your outstanding ability to wake the dead, i couldnt have done it better myself. :ba:

this info is so outdated you are better off starting a new thread. im sure something similar could be made simpler now.

Oh, yes it is absolutely possible.

The above implementation is based on playing a turning action (frame 0…360).

The keybaord keys w,a,s,d are mapped to messages “player north”, “player east”, “player south”, “player west”. These messages are mapped to frames 0,90,180,270 (property “direction” at object player tracking).

You can indeed implement a Python controller that changes the property “direction” at object player tracking according to the joystick input. Ensure the values are within 0.0 and 360.0 (I do not think it hurts to exceed this range).

You can replace the MouseOrbiter by your own camera moving implementation (e.g. the mouse actuator).