Professional Web Applications Themes

Simple Collison Detection - Whats Wrong - Macromedia Director 3D

Hello Im doing a simple tour for my coursework and am using simple collision detection using Lingo's built in collision modifiers. The collision works - its just that when the objects collide, the movie should jump to a new frame with the label - 'movie1' Can anyone see what I'm doing wrong? Thanks in advance for help! on beginSprite me sprite(me.spriteNum).member.resetWorld() -- lock camera to character sprite(1).member.model("Character").addChild(sprit e(1).member.camera[1]) -- get a reference to the camera pCamera = sprite(me.spriteNum).camera -- turn fog on pCamera.fog.enabled = FALSE -- recognize but near and far pCamera.fog.decayMode = #linear pCamera.fog.near = 5000 pCamera.fog.far = 8000 ...

Sponsored Links
  1. #1

    Default Simple Collison Detection - Whats Wrong

    Hello
    Im doing a simple tour for my coursework and am using simple collision
    detection using Lingo's built in collision modifiers. The collision works - its
    just that when the objects collide, the movie should jump to a new frame with
    the label - 'movie1'
    Can anyone see what I'm doing wrong? Thanks in advance for help!
    on beginSprite me
    sprite(me.spriteNum).member.resetWorld()

    -- lock camera to character
    sprite(1).member.model("Character").addChild(sprit e(1).member.camera[1])
    -- get a reference to the camera
    pCamera = sprite(me.spriteNum).camera

    -- turn fog on
    pCamera.fog.enabled = FALSE

    -- recognize but near and far
    pCamera.fog.decayMode = #linear

    pCamera.fog.near = 5000
    pCamera.fog.far = 8000
    myModel = sprite(me.spriteNum).member.model("Character")

    myModel.addModifier(#collision)
    sprite(me.spriteNum).member.model("Character").add Modifier(#collision)
    sprite(me.spriteNum).member.model("University").ad dModifier(#collision)

    -- set all collision detection to #mesh
    myModel.collision.mode = #mesh
    sprite(me.spriteNum).member.model("Character").col lision.mode = #mesh
    sprite(me.spriteNum).member.model("University").co llision.mode = #mesh


    -- set callback for collisions
    sprite(me.spriteNum).member.registerForEvent(#coll ideAny,#handleCollision,me)

    end

    on exitFrame me
    if keyPressed(123) then -- left arrow
    sprite(me.spriteNum).member.model("Character").rot ate(0,10,0)
    else if keyPressed(124) then -- right arrow
    sprite(me.spriteNum).member.model("Character").rot ate(0,-10,0)
    else if keyPressed(125) then -- down arrow
    sprite(me.spriteNum).member.model("Character").tra nslate(0,0,20)
    else if keyPressed(126) then -- up arrow
    sprite(me.spriteNum).member.model("Character").tra nslate(0,0,-20)
    end if

    on handleCollision me, collisionData
    go to "Movie1"
    end

    Sponsored Links
    mbrown174 Guest

  2. #2

    Default Re: Simple Collison Detection - Whats Wrong

    I'm not all that familliar with the built in collision methods, but at a guess
    it may be to do with when the 'go to' command is being called. I would
    try defining a property called 'movieJump' in your behaviour, and then set that
    property in your 'handleCollision' handler, eg:

    on handleCollision me, collisionData
    movieJump = true
    end

    And then act on that property within your exitframe handler, eg:

    on exitFrame me
    (rest of your code)...
    if movieJump then
    go to "Movie1"
    end if
    end

    Hope this helps!

    - Ben

    duckets Guest

  3. #3

    Default Re: Simple Collison Detection - Whats Wrong

    Many Thanks for that. Im still learning Lingo and that will come in handy...
    mbrown174 Guest

Similar Threads

  1. hmm whats wrong ??
    By mak999 in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: February 16th, 10:05 PM
  2. whats wrong with my sql?
    By loofa in forum Coldfusion Database Access
    Replies: 3
    Last Post: July 25th, 08:47 AM
  3. Anyone know whats wrong with this?
    By Mike M in forum ASP Database
    Replies: 5
    Last Post: February 17th, 11:56 PM
  4. im just about to give uo, whats wrong!!!
    By GilesW webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 0
    Last Post: October 30th, 02:46 AM
  5. [PHP] Whats wrong?
    By Ryan A in forum PHP Development
    Replies: 0
    Last Post: September 13th, 01:07 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