Professional Web Applications Themes

Collision Detection and Jumping to Another Frame - Macromedia Director 3D

Is there any reason registerForEvent using #collideAny would not send the playback head to a requested frame in the score? The collision I need to be detected is being detected, and any code I ask to be run after the collision is detected will run...anything except _movie.go(frame number or marker name) - i.e. _movie.go(35) or _movie.go("level2"). Been pouring over sites and it's driving me crazy. Any help appreciated and I can post code if needed. Lorax...

  1. #1

    Default Collision Detection and Jumping to Another Frame

    Is there any reason registerForEvent using #collideAny would not send the
    playback head to a requested frame in the score? The collision I need to be
    detected is being detected, and any code I ask to be run after the collision is
    detected will run...anything except _movie.go(frame number or marker name) -
    i.e. _movie.go(35) or _movie.go("level2"). Been pouring over sites and it's
    driving me crazy. Any help appreciated and I can post code if needed.

    Lorax

    Lorax2003 Guest

  2. #2

    Default Re: Collision Detection and Jumping to Another Frame

    Collision detection takes place after exitFrame and before the frame is
    redrawn. This means that Director can resolve any collisions, and thus place
    models in their impact positions before the scene is refreshed . Here is the
    event sequence:

    frame (n-1)?#exitFrame
    * Collision detection takes place here
    frame n?????#stepFrame
    frame n?????#prepareFrame
    frame n?????#enterFrame

    You can use 'go frame x' navigation in a stepFrame handler, but you cannot use
    it in a prepareFrame handler. This is because the prepareFrame handler is
    triggered by a jump to a new frame. If it could also trigger a jump then you
    could get caught in an endless loop.

    The handler registered for collisions (either by the setCollisionCallback()
    method for a given model or by the registerForEvent() method for a Shockwave3D
    member) behaves like the prepareFrame handler: you can't use it for navigation.
    Presumably this is because navigating to another frame would trigger the
    collision callbacks all over again.

    The workaround is to use the stepFrame handler to perform any necessary
    navigation:

    property pFrame

    on mCollisionCallback(me, aCollisionData)
    ??-- do any collision stuff
    pFrame = marker(1) -- the next marker
    ??(the actorList).append(me)
    end

    on stepFrame(me)
    ??go pFrame
    ??(the actorList).deleteOne(me)
    end


    You can find a demonstration movie with a more comprehensive approach at:

    [url]http://nonlinear.openspark.com/alpha/CollideMarker.dcr[/url]

    Source at:

    Mac: [url]http://nonlinear.openspark.com/alpha/CollideMarker.sit[/url]
    Win: [url]http://nonlinear.openspark.com/alpha/CollideMarker.zip[/url]

    openspark Guest

  3. #3

    Default Re: Collision Detection and Jumping to Another Frame

    Not a bad way to start the morning! Your explanation/advice worked like a
    champ. I knew I wasn't seeing or approaching the problem from the right angle.
    I was able to modify my code and get it working in no time! Thanks again!


    Lorax

    Lorax2003 Guest

Similar Threads

  1. collision detection
    By Seph webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 18
    Last Post: May 20th, 09:24 AM
  2. Using ModelsUnderRay Collision detection
    By Roofy in forum Macromedia Director 3D
    Replies: 1
    Last Post: June 28th, 04:45 AM
  3. 3d collision detection
    By needhelp2005 in forum Macromedia Director 3D
    Replies: 0
    Last Post: May 9th, 10:33 PM
  4. newbie: jumping from 3d sprite frame to flash frame
    By CDR in forum Macromedia Director Basics
    Replies: 0
    Last Post: January 31st, 07:37 PM
  5. Massive collision detection
    By oeyvind toft in forum Macromedia Flash
    Replies: 6
    Last Post: August 5th, 02:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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