5 Replies Latest reply on Dec 24, 2008 11:42 AM by scharansky

    Trying to get collision detection working with havok

    josiewales
      Hi - I'm having some trouble using collision detection within director using a w3d file with havok applied to it. I've been using the registerinterest function but I get a "value out of range" error.

      This is my code (there is a cone and box on a plane imported from 3d max - named Cone01 and Box01 these are both movable rigid bodies).

      on beginSprite me
      box1=member("3d").model("Box01")
      cone1=member("3d").model("Cone01")
      w = member ( 1 )
      hk = member( 2 )
      hk.initialize( w, 0.1, 1 )
      hk.registerInterest (box1, cone1, 10, 0, #collision, me)
      end

      on collision me, details
      sound(2).play(member("hihats"))
      end

      on enterFrame me
      end

      -----------
      I've also tried this and had no luck:
      on beginSprite me
      rb1 = sprite(1).pHavok.rigidBody("Box01")
      rb2 = sprite(1).pHavok.rigidBody("Cone01")
      w = member ( 1 )
      hk = member( 2 )
      hk.initialize( w, 0.1, 1 )
      hk.registerInterest (rb1, rb2, 10, 0, #collision, me)
      end

      Any help would be great.
      Thanks