In the following example there is a guy and a boat. They have both a position, orientation and velocity.

enter image description here

The guy is standing on the shore and would like to board. He changes his position so he is now standing on the boat.

enter image description here

The boat changes velocity and orientation and heads off. My character however has a velocity of 0,0,0 but I would like him to stay onboard. When I move my character around, I would like to move as if the boat was the ground I was standing on.

enter image description here

How do keep my character aligned properly with the boat? It is exactly like in World Of Warcraft, when you board a boat or zeppelin.

This is my physics code for the guy and boat:



The guy already has a reference to the boat he's standing on, and thus knows the boat's position, velocity, orientation (even matrices or quaternions can be used).

  • 2
    \$\begingroup\$ Some of the answers to this similar question may help a little with the rotation aspect of this \$\endgroup\$ Commented Oct 10, 2012 at 20:52
  • \$\begingroup\$ Is this being driven by a physics engine? That's the part I'm unsure about, because otherwise it would be simple to solve using a scene graph. All you would have to do was add the character as a child to the boat node when they first establish contact. Conversely, once the character left the boat, all you would have to do was detach him from the boat node and re-add him to the root node of the hierarchy. Parenting and keeping the relations between nodes is already an integral part of the scene graph. \$\endgroup\$ Commented Oct 10, 2012 at 21:00
  • \$\begingroup\$ What have you tried? You're essentially just going to apply the of the boat transforms to the character too. Then apply the rotations of the character in that reference. \$\endgroup\$
    – House
    Commented Oct 10, 2012 at 21:01
  • \$\begingroup\$ @David Gouveia Unfortunately I can't use a physics engine (use WebGL) \$\endgroup\$
    – Nick
    Commented Oct 10, 2012 at 21:04
  • \$\begingroup\$ @Nick You misunderstood. If you were using a physics engine it might be more difficult to implement a scene graph. If you're not using one, then it should be be a good solution. I've googled for "WebGL scenegraph" and found a few ready solutions. Give them a try. Basically what you want in the end is a system where you can simply do boat.children.add(character) and everything else works automatically. \$\endgroup\$ Commented Oct 10, 2012 at 21:11

1 Answer 1


Your best luck is to learn some matrix math.

You should have some kind of scene graph that establishes the character as a child node of the boat. It then would store it's position relative to the boat.

The boat would have a transformation matrix, you apply that to the child nodes, and the child nodes could stack some more transformations on the matrix letting you move around the boat while moving relative to it.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .