In short, I am wondering if there is a method of changing an object's origin, so that when functions such as getPosition or setForce are called, they return the position of a certain point on the object or apply a force to a certain point on the object, rather than the center of the object.
Specifically, I am developing an application using the Novint Falcon, a 3D haptic device, for input. For the sake of explanation let's pretend it's a golf simulation, and we are using a long box to represent a golf club. We call getPosition() on the box and use the difference between the position of the box and the position of the Falcon to calculate a force. We then applyForce() back to the box. The problem is that the force is calculated with respect to and applied to the origin (center) of the box. Of course in the real world one holds the end of a club, not the middle! So instead of using the center of the box to calculate position and apply force, we should really use one end of it. I see three solutions to this:
- Use the position and orientation of the club to manually calculate the position of a point on it, which involves some heavy math, especially considering that velocity and force transformations are much more complex than simple position transformations
- Relocate the origin to the end of the club (preferred, I think this would work if such a feature exists)
- Attach a massless object rigidly to the end of the club and use this object instead of the box for purposes of calculations and control (hackish but easy)
Obviously I am very new to Havok, so any guidance is appreciated!