you know… ive been working with this idea for a long time… and today it just hits me… the result for making paths in gameblender… but, it was way too simple to have not been done before, i think its old news but i guess it wouldnt hurt to post
if youre asking what a path is, well in this case its your characters movement trail that an enemy can follow(around corners, into corridors, spiral staircase, anything)…
this is a basic basic demo but can easily be built upon… adjust the enemies speed if hes too fast
let me know what you think or if im wasting your time
sounds like a cool concept, but, how do I implement it?
select the main player, give it an always sensor(true pulse on, pulse of 4-10) >> python controller(“getPos”)
select the “track” box… this is what the enemy tracks to and moves towards so we will set this box along the path of the character…
give it a collision sensor >> 2 python controllers “setPos” and “remove”
now give the enemy an always sensor >> motion acutator(so he keeps moving forward) and a track actuator(track to “track” object)
give camera logic bricks always(true pulse off) >> python(“start”)
if you wanna know what the scripts do:
start = sets initial path list so theres no python errors
getPos = adds the current position of the main player to a list of coordinates that create a path
setPos = sets the position of the track object to the first value in the path list
remove = after enemy reaches that first position and touches the track object, it removes the first value of the path list which means the track object will now move to the next value in the list
Nice script! You probably could do this for a race AI as well, have a position setter (the square) and then have the cars follow the path. It would be a great easy way to do it.