4 Replies Latest reply on Jun 26, 2006 7:28 AM by Newsgroup_User

    Why arent the wheels connected to Havok

    Roofy Level 1
      Ok I am totally lost with this havok thing. I am trying to understand what gets attached to the havok physics engine when designing a car racing game. However, after downloading both the jeep car and the remote control car games from director-online havok archive site, I noticed something very stange. While trying to decipher the code on both files it seems to me that the wheels are not attached to the Havok physic's engine. Now I could be wrong, but I wanted to ask you guys if this is correct, and if so, then how do the wheels follow the car as well as stay on the ground and without going through the ground? I am asking this becuase I could not pick it out through its lingo. There are so many behaviours attached to the 3d world that it is impossible to know where Director starts to read each behaviour.

      I understand a little bit about havok, such as if you want something movable then you attach a movable rigid body to it and if the object is fixed then you would attach the fixed rigid body to it. In addition, I also know a little bit about mass which sets the weight of the object. However, it seems to me that both of these games are way too advamced for me especially when just for now all I am trying to unserstand is how the wheels of a car can follow the body of the car and also for the wheels to stay on the ground and without them going through the ground.
        • 1. Re: Why arent the wheels connected to Havok
          Roofy Level 1
          Ok, lets start with the small stuff first, and maybe this will answer my original quesdtion. Looking at the jeep demo, what is the magnet object model for? Is that what the chassis and the wheels follow on and does this magnet model work like how real magnets do?
          • 2. Re: Why arent the wheels connected to Havok
            Level 7
            Roofy wrote:
            > Ok, lets start with the small stuff first, and maybe this will answer my
            > original quesdtion. Looking at the jeep demo, what is the magnet object model
            > for? Is that what the chassis and the wheels follow on and does this magnet
            > model work like how real magnets do?
            >

            IIRC, the example you�re talking about has a "chassis" whose model
            consists in 4 wheels and the car itself it�s only attached to the
            chassis by a spring or dashpot to give the amortiguation effect.

            HTH,
            --
            Agust�n Mar�a Rodr�guez

            www.onwine.com.ar > Macromedia Director demos & code
            • 3. Re: Why arent the wheels connected to Havok
              Roofy Level 1
              quote:

              IIRC, the example you�re talking about has a "chassis" whose model
              consists in 4 wheels and the car itself it�s only attached to the
              chassis by a spring or dashpot to give the amortiguation effect.


              ok, I might be wrong on this, but after pressing play and typing the following syntax in the message window...
              form the jeep demo ....
              put member("blankHavok").lineardashpot
              put member("blankHavok").spring.count

              and from the RemoteControl Car demo
              put member("carHKE").lineardashpot
              put member("carHKE").spring.count



              ... doing this in both files and after pressing play, I get an emplty list returned back for the dashpot and 0 for the count of the spring. So I don't think there are any dashpots nor springs on either demo. However, what I am concluding is that I think they are using 2 custom handlers called initializeHover and updateHover which is somehow detecting the chassis and its wheels if they collide or not. I did a test by disabling both of these custom handlers and by doing so, the chassis would fall through the wheels and land on the ground instead. On the other hand, if these 2 custom handlers are causing this effect, then I srill don't understand how the the wheels are following the chassis. Therefore, I am wondering if it would be easier to use modelsUnderRay considering that all I am trying to do is do collision detection? What do you think?
              • 4. Re: Why arent the wheels connected to Havok
                Level 7
                Roofy wrote:
                >
                quote:

                IIRC, the example you?re talking about has a "chassis" whose model
                > consists in 4 wheels and the car itself it?s only attached to the
                > chassis by a spring or dashpot to give the amortiguation effect.

                >
                > ok, I might be wrong on this, but after pressing play and typing the following
                > syntax in the message window...
                > form the jeep demo ....
                > put member("blankHavok").lineardashpot
                > put member("blankHavok").spring.count
                >
                > and from the RemoteControl Car demo
                > put member("carHKE").lineardashpot
                > put member("carHKE").spring.count
                >
                >
                >
                > ... doing this in both files and after pressing play, I get an emplty list
                > returned back for the dashpot and 0 for the count of the spring. So I don't
                > think there are any dashpots nor springs on either demo.

                Sorry, I thought you were talking about this demo:

                http://director-online.com/havok/demos/demo-dashcar.html

                > However, what I am
                > concluding is that I think they are using 2 custom handlers called
                > initializeHover and updateHover which is somehow detecting the chassis and its
                > wheels if they collide or not. I did a test by disabling both of these custom
                > handlers and by doing so, the chassis would fall through the wheels and land on
                > the ground instead. On the other hand, if these 2 custom handlers are causing
                > this effect, then I srill don't understand how the the wheels are following the
                > chassis. Therefore, I am wondering if it would be easier to use modelsUnderRay
                > considering that all I am trying to do is do collision detection? What do you
                > think?

                Actually, this RayCastCar demo uses modelsUnderRay() for collision
                detection of the wheels with the ground:

                -- For each wheel do
                repeat with i = 1 to pWheelPointList.count
                pIsHoveringList = false
                worldWheelPoint = pChassisMDL.transform * pWheelPointList

                intersectDetails = pMember.ModelsUnderRay(worldWheelPoint,
                worldDownDir, 2, #detailed)

                So the physics and control are applied to the chassis and the wheels are
                just "floating". At which distance should they float is what
                modelsUnderRay() is used for.

                This doesn�t mean that you don�t need Havok at all and you can use
                modelsUnderRay() instead since havok handles all the driving physics and
                MUR just the distance of the wheels to the chassis.

                Regards,
                --
                Agust�n Mar�a Rodr�guez

                www.onwine.com.ar > Macromedia Director demos & code