havok collision detection problem

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

  1. #1

    Default havok collision detection problem

    Hello everyone,

    Been posting a few problems recently some of which I found my answers myself
    after a bit more thinking. So promise this will be last one for a while anyway!
    :tounge;

    I'm using havok via importing the havok physics scene into the cast [non hke]
    and trying to add collision detection to my complex model (a castle!) and well
    its not really doing anything my characters can still walk through the walls,
    but there are no errors as well so I can't see where I'm going wrong :rose;

    Heres the code I have.

    on beginSprite me
    myHk = member("havok")
    myMember= sprite(me.spritenum).member
    myTolerance = 4.0 -- usualy only 10% of worldscale
    myWorldScale = 1 -- inches (1 inch = 0.0254 metres [use 1.0 if world is
    designed using Metres]
    myGravity = vector(0, -9.81, 0) -- for 1.0 metre scale, use vector(0, -9.81,
    0)
    myHk.initialize( myMember, myTolerance, myWorldScale ) -- set it up
    myHk.gravity =myGravity
    -- used by the step() function in the exitframe
    myTimeStep = 0.04 -- 1/25.0 i.e. 25 fps
    mySubSteps = 5 -- used by havok to calculate between time steps

    mlist = ["castle","water", "knight", "whiteknight"] --this is a list of
    model-numbers I want to apply physics to

    player = myMember.model("knight")
    player.addModifier(#meshDeform)
    prb = myHk.makeMovableRigidBody("knight",100,true,#box)

    player2 = myMember.model("whiteknight")
    player2.addModifier(#meshDeform)
    prb2 = myHk.makeMovableRigidBody("whiteknight",100,true,# box)

    m = myMember.model("castle")
    m.addModifier(#meshDeform)
    myHk.makeFixedRigidBody(m.name,false)

    m = myMember.model("water")
    m.addModifier(#meshDeform)
    myHk.makeFixedRigidBody(m.name,false)
    end

    on exitFrame me
    myHk.step( myTimeStep, mySubSteps ) -- advance the simulation

    --Down
    if keyPressed(125) then
    player.translate(0,-5,0)
    end if

    --up
    if keyPressed(126) then
    player.translate(0,5,0)
    end if

    --left
    if keyPressed(123) then
    player.rotate(0,0,5)
    end if

    --right
    if keyPressed(124) then
    player.rotate(0,0,-5)
    end if
    end

    on endSprite me
    myHk.shutdown() -- Tidy up, i.e. remove it from memory
    end

    Any ideas of what could be going wrong? Can havok be applied to complex
    models?

    Cheers in advance for any suggestions!

    Brenden
    :wink;

    JustStupid Guest

  2. Similar Questions and Discussions

    1. collision detection in havok?
      Is there any ways to detect two movable regid bodies collide or not?
    2. Cinema 4d > w3d collision detection problem
      When i export my 3d scene in Cinema 4d everything goes fine. But when I import the scene in director and add my Collision detection script, I can...
    3. Problem with #Collision Modifier detection
      Hi all Please help me. Using #collision modifier, I cant detect collision with an editable spline model imported from dwg (Autocad) to...
    4. Havok Collision Detection
      For my project I need to detect multiple collisions on one object. To do this I have been attempting to use various bounding boxes and using a...
    5. Collision detection Problem
      hai, I am using modelsUnderRay method to check my collision which has been described in the tutorial in the link below.... ...
  3. #2

    Default Re: havok collision detection problem

    >I found my answers myself after a bit more thinking
    thats a very clever move!!!

    but the problem is not the set up of the scene, it's your navigation. If you
    want to move a Object in the havok world, you have to do this with forces.

    i did some time ago this little demo to make a very simple navigation with
    havok.

    [url]http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=268&threadid=[/url]
    1082944&highlight_key=y&keyword1=havok

    the code has a lot of comments, if you have more questions just ask.

    regards!

    hondo3000 Guest

  4. #3

    Default Re: havok collision detection problem

    Thanks I will check it out! :wink;
    JustStupid 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