3 Replies Latest reply on Jun 17, 2006 5:34 AM by _lw

    Rotation with Rigidbody

      I'm having somewhat of a trouble with rotation of a Rigidbody.
      You see, I have two models, where one of them uses a Rigidbody. The problem is, however, that I want that rigidbody to have the same rotation as the model that doesnt use a rigidbody. I have tried solve this for quite some time without any luck.

      Any ideas how to do?

        • 1. Re: Rotation with Rigidbody
          You could try to make the model of the rigidbody a child of the model you rotate. Make sure you use it with the #preserveworld to not screw up their positions.

          modelA.addChild(modelB, #preserveworld)

          I think this should work.
          • 2. Re: Rotation with Rigidbody
            It's been a while, and I don't have director in front of me to check the syntax, but I believe something like this might work for you:

            desiredRotation = plainModel.transform.rotation.axisAngle
            rigidBody.rotation = desiredRotation

            and run that everyframe or whenever is appropriate to keep it updated. Hope that helps some....

            • 3. Re: Rotation with Rigidbody
              _lw Level 1
              you should keep in mind that a havok body should be only conltrolled with the havok comands! the havok world is inside the havok castmember and it is invisible. the objects in the visual world only a representation of things happening in havok-land. That means, if a model is turned into a havok model, it should not be manipulated with normal lingo comands.

              The havok bodies should be moved by forces, impulses, angularvelocity, linearvelocity ... (all in the havok-lingo-reference)

              It's possible to set the rotation and the position of a havok body with havok-lingo-comands, but in setting the position and rotation without the use of forces, will exclude the model from the collision detection. Using "rotation" and "position" is in this case similar to "beam" the object to a new position by ignoring the physical rules.

              but to stick a object to a lingo controlled model you can use dashpods. If you use a angular dashpod, you can update its rotation and set it to the rotation of the lingo-controlled model. By making this agualar dashpod very strong, it will try to be very close to the given rotation.

              >modelA.addChild(modelB, #preserveworld)
              this is not a good idea because it will not move the havok body, only the visual representation. The havok model will not move. havok models can only be moved by havok comands.

              >desiredRotation = plainModel.transform.rotation.axisAngle
              >rigidBody.rotation = desiredRotation

              this will work, but exclude the collision detection.

              Apply a angulardashpod to that havok model and set its rotation like this:


              this should work. depending on the strenght of this dashpot, the motion will be applied. You should also take a look into the havok-lingo-reference on how to use "registerstepcallback" to build a handler that will execute the havok-code on havok timesteps.

              hope this is a littel help...