setting fixed path of movement

i would like to set a fixed path of movement through an openfield environment so that whenever the user gives forward mouse movement, this progresses the user forward in the fixed path. the path zigzags, so at certain points, forward mouse movement should turn the user instead of moving forward.
i currently do this with a lot of if statements so that when the user gets within a certain range of positions, then mouse movement controls camera angle. is there a better way to implement this?

How about ghost objects so when your character collides with the object on the ground it knows to turn, otherwise it goes forward by default.


You may want to use Motion Paths, there is a page on them in the manual and I’m almost sure there should be some sample posted somewhere here on the forum.

For some pyWeek entry I needed a sort of guide/beacon to show the way where the player should move, and because the time was short I used a animated model for that. You could do the same - make a joint/bone/armature then make an animation of it moving along your path in your favorite modeling blender, then just export/import it. You can then play/stop/rewind or play it at a specific rate (forward or backwards) based on the player input (mouse movement) and whatnots.

Which part, specifically, are you having trouble with–the following of a path, or the switching from path-following to camera movement?

If the latter, one option might be to use two separate “controller” classes, one each for “path-following” and “looking”, each exposing the same set of methods with their own logic within, and switch between instances of these; you then keep a variable indicating the current “controller” object and only update and provide input to that.

thanks for all the suggestions! i will try them in chronological order