Professional Web Applications Themes

Detecting two objects colliding - Macromedia Director 3D

Hi hope someone can help with this. I have a cube and a sphere in the scene and the sphere can be moved by keyboard controls, but how can i code it so that it will detect if it collides with the cube. Now ive coded it so that it has a collision modifier so that if the sphere can collide with the cube:- on beginsprite amount = 0 amount2 = 0 member("DETECT~1").model("sphere").addmodifier(#co llision) member("DETECT~1").model("sphere").collision.enabl ed = TRUE member("DETECT~1").model("sphere").collision.mode = #mesh member("DETECT~1").model("sphere").collision.resol ve = TRUE member("DETECT~1").model("Cube").addmodifier(#coll ision) member("DETECT~1").model("Cube").collision.enabled = TRUE member("DETECT~1").model("Cube").collision.mode = #mesh member("DETECT~1").model("Cube").collision.resolve = TRUE member("DETECT~1").model("Cube").collision.immovab le = TRUE ...

  1. #1

    Default Detecting two objects colliding

    Hi hope someone can help with this. I have a cube and a sphere in the scene
    and the sphere can be moved by keyboard controls, but how can i code it so that
    it will detect if it collides with the cube. Now ive coded it so that it has a
    collision modifier so that if the sphere can collide with the cube:-

    on beginsprite
    amount = 0
    amount2 = 0

    member("DETECT~1").model("sphere").addmodifier(#co llision)
    member("DETECT~1").model("sphere").collision.enabl ed = TRUE
    member("DETECT~1").model("sphere").collision.mode = #mesh
    member("DETECT~1").model("sphere").collision.resol ve = TRUE

    member("DETECT~1").model("Cube").addmodifier(#coll ision)
    member("DETECT~1").model("Cube").collision.enabled = TRUE
    member("DETECT~1").model("Cube").collision.mode = #mesh
    member("DETECT~1").model("Cube").collision.resolve = TRUE
    member("DETECT~1").model("Cube").collision.immovab le = TRUE
    end

    but what i dont know how to do is how to code it so that once the sphere
    touches the cube then it will play a new marker. Does anyone know how to do
    this?

    ZeppelinFan Guest

  2. #2

    Default Re: Detecting two objects colliding

    yeah dude that's pretty easy once you know how to do it. you make a handler
    that tells the movie to got to the marker you want, and use
    setCollisionCallback() to call that handler. go to director help, then the
    index tab, and type in setCollisionCallback. you'll find all the info you need.

    Ex Malterra Guest

  3. #3

    Default Re: Detecting two objects colliding

    Ok how do i make handlers?
    ZeppelinFan Guest

  4. #4

    Default Re: Detecting two objects colliding

    Have a look at hondo3000's zip file under the 'Collision detection' thread.

    I think you'll find it has the routines you need
    optics42 Guest

  5. #5

    Default Re: Detecting two objects colliding

    Originally posted by: ZeppelinFan Ok how do i make handlers? handlers are
    custom functions you write in lingo or javascript syntax. it's good to know how
    to leverage lingo or javascript syntax, you should learn all you can. a good
    place to start would be the director scripting reference, found in director
    help or in pdf format
    [url]http://www.macromedia.com/support/doentation/en/director/index.html#manuals[/url].

    Ex Malterra Guest

Similar Threads

  1. detecting mouse movements within objects
    By James in forum Macromedia Flash
    Replies: 2
    Last Post: March 3rd, 08:51 PM
  2. Pls. help with keeping content from colliding
    By veto in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: November 8th, 12:38 PM
  3. colliding objects question, Flash 5
    By Algomeysa2 in forum Macromedia Flash
    Replies: 0
    Last Post: July 19th, 03:24 PM
  4. Newbie Question? Aligning Objects to other Objects?
    By grant.smith@adobeforums.com in forum Adobe Illustrator Macintosh
    Replies: 6
    Last Post: April 27th, 09:10 PM
  5. Storing Objects/Arrays in Stored Objects
    By teflon000 webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: January 24th, 07: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