4 Replies Latest reply on Aug 7, 2006 11:39 PM by Necromanthus

    substituting Havok's linear velocity

    Roofy Level 1
      Hi there all,
      could any one explain to me how I could calculate how much the wheels of a car should spin according to how fast the car is going without using Havok? I ask this because I am not using Havok, therefore I can not use the

      forwardVel = worldForwardDir * pChassisRB.linearVelocity

      ... method that havok uses considering that I do not know another way how to get the chassis's linearVelocity.
        • 1. Re: substituting Havok's linear velocity
          Roofy Level 1
          Ok, I got some information from the internet, and basically it says that I would need to know the speed of the car, the radius of the wheels and the circonfrence of the wheels. However, I am back to square one because from looking at any of the havok demos that I have downloaded they all show one way on how to get the speed of the chassis by doing this...

          currentVel = pChassisRB.linearVelocity
          currentSpeed = currentVel.dot(worldForward)

          as you can see, again the havok linearVelocity function is being used along with getting the dotproduct of worldForwardDirection which causes a problem since I am not using havok to retrieve the chassis's linearVelocity. In addition, I have spent a few days searching on the internet on how to find linearVelocity, but all of the web articles that I have found, its end results becomes a scalar. However, in Havok, I noticed that their type of linearVelocity is a vector. So I am really lost in the dark, and I would appreciate it if anyone could help me out to find the chassis's current speed.
          • 2. Re: substituting Havok's linear velocity
            Necromanthus Level 2
            R = wheel radius
            speed = Distance per frame (if your speed is shown as distance/second or distance/hour, check out the FPS value)
            Presuming your model is exported from 3DSMax:

            member("whatever").model("wheel").rotate(0, (360*D)/(6.28*R), 0)

            note: in case of very high speed, pay attention to rotations over 179 degrees per frame (you'll get 'unexpected' results).
            You have to divide them into a sequence of smaller rotations (in the same frame !)
            cheers
            • 3. Re: substituting Havok's linear velocity
              Roofy Level 1
              Thanks necromanthus
              But I have one question. Where are getting 6.28 * R from? Is that for the formula 2 * pi * radius. I ask this because I think my wheels are spining too fast
              • 4. Re: substituting Havok's linear velocity
                Necromanthus Level 2
                quote:

                Originally posted by: Roofy
                Thanks necromanthus
                But I have one question. Where are getting 6.28 * R from? Is that for the formula 2 * pi * radius. I ask this because I think my wheels are spining too fast


                wheel circumference = 2 * PI * R = 6.28 * R
                The get the right speed you have to put in a frame script the both motions:
                member("whatever").model("car").translate(D, 0, 0)
                member("whatever").model("wheel").rotate(0, (360*D)/(6.28*R), 0)


                Don not use the keyframe player to move the car because it works asynchronous !
                cheers