I am curious how you might go about making a character that is able to change from moving around and rotating in world space to being "locked" to an object. So that if the object rotates, your character would be moved so that you stay in the same relative position to the object, while still maintaining the ability to move, just now your movement would be relative to the "anchor" object. The character should then also be able to "detach" from the object, so that it no longer is affected by movement and rotation of the object.
Thanks for any ideas you might have!
Relative Character Movement
Re: Relative Character Movement
The CharacterController in the BEPUphysicsDemos can already do this with its HorizontalMotionConstraint (though the camera doesn't rotate with the support by default- there's a commented out chunk in the CharacterCameraControlScheme.Update that shows how to do that). Two-body constraints in general are only aware of the relative velocity between objects, not the absolute world space velocity.
Things get a little trickier when you want the character to stay locked in relative position as the base rotates while the character isn't actually touching the anchor, though. For example, straight world space lines that occur while jumping would appear curved in the local rotating frame of reference. This would require centripetal force to counteract. That wouldn't be too hard to compute and apply.
If you don't want to deal with physical rotation, there's also the option of moving the character into a special space associated with the rotating anchor. Within that space, the anchor is stationary. The results of that nonrotating simulation would then be transformed into world space using the current anchor state. You could either implement this conceptually, by doing the math and implementing movement accordingly, or explicitly, but actually having a separate space that objects are moved between.
Watch out: the further the implementation moves from a coherent physical simulation, the more hacks and problems will show up.
Things get a little trickier when you want the character to stay locked in relative position as the base rotates while the character isn't actually touching the anchor, though. For example, straight world space lines that occur while jumping would appear curved in the local rotating frame of reference. This would require centripetal force to counteract. That wouldn't be too hard to compute and apply.
If you don't want to deal with physical rotation, there's also the option of moving the character into a special space associated with the rotating anchor. Within that space, the anchor is stationary. The results of that nonrotating simulation would then be transformed into world space using the current anchor state. You could either implement this conceptually, by doing the math and implementing movement accordingly, or explicitly, but actually having a separate space that objects are moved between.
Watch out: the further the implementation moves from a coherent physical simulation, the more hacks and problems will show up.