Ask a Question related to Macromedia Director 3D, Design and Development.

  1. #1

    Default 3d Pathfinding

    I have scavenged the net for information in how to apply the Astar pathfinding
    algorithm to shockwave 3d. Although I didn't find any examples at all for the
    3d part, I found a couple meant for 2d pathfinding.
    So I decided to write a tutorial with code examples just for Shockwave 3d
    and lingo since this is something I think would help many in their game
    developing. And the more people developing stuff in Director, the more (much
    needed) attention towards the great program.

    But here comes the catch; I don't really know how to implement it to 3d
    myself. For starters, I'm just going to make it simple, no obstacles that cost
    more to pass, just fair and square a -> b.

    So for step one I understand that I need to divide my terrain into a grid,
    let's say 100 x 100. What would be the easiest way for this? Using lists?
    Nothing advanced now, no height changes, the ground I am using now is just a
    large plane object.

    So for the greater good, please share your 2 cents!


    Mazuho Guest

  2. Similar Questions and Discussions

    1. 3D Pathfinding without a grid or nodes question andsuggestions
      I am currently developing an RTS game and wish to incorporate pathfinding into the movable units. The problem is that all pathfinding algorithm...
  3. #2

    Default Re: 3d Pathfinding

    I don't use A-star, but an old and very talented shockwave developer (aka
    MEDION) has a great tutorial on this subject:
    [url]http://www.station-zero.com/medion/demos/pathfind.htm[/url]
    [url]http://www.station-zero.com/medion/demos/pathfind.zip[/url]

    a tip: to decrease the requested processing power, divide the world into
    several zones (sectors) and use few predefined paths.

    necromanthus Guest

  4. #3

    Default Re: 3d Pathfinding

    Thanks for that example, it gave me a lot of reading last night =).
    I have read all the code now, and I understand most of it. But what I don't
    understand is how I can generate the text member that contains all the nodes,
    which sectors they belong to and all the vectors for all the nodes. Surely he
    didn't write all that by hand? So is there a step I have missed maybe between
    exporting and importing the map? Because the code in Director relied on this
    member, so it couldn't have been generated using any of the code already
    there...

    Progress update: I now know how to move a pre-selected object from a -> b with
    interpolation. Only works good on a planar object.

    Next step: Get to grips with everything that pathfinding involves in MEDION's
    example. A really good example, thanks necromanthus!

    Mazuho Guest

  5. #4

    Default Re: 3d Pathfinding

    Okay, now I know where the exported info came from. But I'm going to use
    director to collect the info that I need. I have made 94 dummies in 3dsmax and
    now I am trying to save the info of these "nodes" into lists. For the
    worldpositions it works, I get the vectors. But when I check for neighbouring
    nodes in all the axes, I only get emptyness. Here's the script I use. Note that
    I am only going to use this script once, as I'll save all the info in a text
    cast member when it is working.

    on startmovie
    w = member("pathfindtest")
    groupc = w.group.count
    tlist =
    repeat with i = 1 to groupc
    if w.group.name contains "node" then
    nnode = nnode + 1
    tlist.addprop("node"&(string(nnode)), w.group.worldposition)
    neighb1 = w.modelsunderray(w.group.worldposition, vector(1,0,0), 1,
    #detailed)
    neighb2 = w.modelsunderray(w.group.worldposition, vector(-1,0,0), 1,
    #detailed)
    neighb3 = w.modelsunderray(w.group.worldposition, vector(0,1,0), 1,
    #detailed)
    neighb4 = w.modelsunderray(w.group.worldposition, vector(0,-1,0), 1,
    #detailed)
    neighb5 = w.modelsunderray(w.group.worldposition, vector(0,0,1), 1,
    #detailed)
    neighb6 = w.modelsunderray(w.group.worldposition, vector(0,0,-1), 1,
    #detailed)
    put neighb1
    if neighb1.count > 0 then
    if neighb1.name contains "node" then
    tlist.addprop("neighbour1"&(string(nnode)), neighb1)
    end if
    end if
    if neighb2.count > 0 then
    if neighb2.name contains "node" then
    tlist.addprop("neighbour2"&(string(nnode)), neighb2)
    end if
    end if
    if neighb3.count > 0 then
    if neighb3.name contains "node" then
    tlist.addprop("neighbour3"&(string(nnode)), neighb3)
    end if
    end if
    if neighb4.count > 0 then
    if neighb4.name contains "node" then
    tlist.addprop("neighb4"&(string(nnode)), neighb4)
    end if
    end if
    if neighb5.count > 0 then
    if neighb5.name contains "node" then
    tlist.addprop("neighb5"&(string(nnode)), neighb5)
    end if
    end if
    if neighb6.count > 0 then
    if neighb6.name contains "node" then
    tlist.addprop("neighb6"&(string(nnode)), neighb6)
    end if
    end if
    end if
    end repeat
    put tlist
    end startmovie


    Mazuho Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139