I did a ballon game once that used basic pathfinding.
setup stuff....
M = Moving object
MX,MY,MZ = Moving objects position
TX,TY,TZ = target position
RFD = rotate object direction flag
RQ = rotated quantity
1 - assume M can move directly to T. The simplest option.
Point Object M,TX,MY,TZ `MY to keep the object from leaning
`store this information as M0
MX0=Object position x(M) ......
MR0=Object Angle y(M) ......which way are we pointing
2 - See if we can actually go the way we are facing
Move Object M,10
3 - Check for collision
If Collision reset object position to M0
Move object M,-10
Set a rotation flag
For now, just assume we decide to rotate right
if RFD=0 then RFD=1
RQ=RQ+RFD*10 .... rotate 10 degrees is desired direction
point object M,TX,MY,TZ
MR = object angle y(M)+RQ
rotate object M,0,MR,0
go back to step 2 and try moving again
else
no colision occured. chech the rotation flags
if RFD
Undo the collision rotation
RQ=RQ-RFD*10
MR=Object angle y(M)+RQ
rotate object M,0,MR,0
if RQ=0 then RFD=0
endif
endif
that should give you the basics of path finding without resorting to the use of waypoints trees. Although, this method can be extended to waypoints as a list of TX,TY,TZ locations. This methos works, is simple, but has 1 major flaw....
It does not know how large the object is that its trying to go around. In my balloon game this was not important as it was usually a mountain or lake. But, if moving room to room in a maze a creature could get lost using this method. Or a creature could get stuck if trapped between objects (trees clustered too close or not close enough). Basically, this method will have a critter track around the collision boundary of your object and resume original heading upon reaching the far side of the object.
internet gaming group