Singapore-MIT GAMBIT Game Lab spacer
spacer New Entries Archives Links subheader placeholder
left edge
Moving is crazy.

So, we finally got movement to work correctly in Visual3D! It involved a lot of banging my head against the keyboard, but eventually we found the solution.

The movement I had implemented previously didn't support diagonal movement (which was bad).

The main problem that I was running up against was that the game maps the WASD keys to moving forward, left, backward, and right automatically. There is no way to stop this (that I've found), and no way to override this. I think it's hidden in their source code somewhere (which we don't have access to). But basically this meant that when trying to intercept the call I was having trouble.

The solution ended up being pretty simple actually. In some commented out code of theirs (tons of code in Visual3D's examples is commented out, I don't know why), we found a reference to TransformSpace.World which was being used in an acceleration object.

Acceleration objects are applied to an actor and that makes them move. Pretty simple. The problem I was having is that once I rotated an actor, the accelerations were using their own frame of reference and therefore going in strange directions. In addition, I wasn't sure how to figure out if the actor was already moving, so I was trying to use a system of getting key inputs and keeping a keyboard map in memory.

The solution was actually to, first of all, tell the accelerations to work in the World.Transform basis. The second part was to calculate the direction from the actor's PhysicsBody object, which stored the current LinearVelocity of the actor. Using this, I was able to make some spiffy quaternions and rotate the actor in the correct direction.

So, the moving works. However, it is very strange that the source code is mapping WASD to directions, and I can't do anything about it. When trying to implement my own KeyMaps, it seemed to work differently than their own. It would be nice to know how keyboard input really works in Visual3D.

right edge
bottom curves