Sunday, March 18, 2012

Control

The control scheme's been throwing me off. The physics code works fine until I try and get it to react to the mouse. Nothing I've tried works very well.

My first thought was to have the mouse control the rotation of the center joint of the character. (The character is made up of three points with a single joint at the middle point.) Doing that interferes with the rest of the physics code though. I can't really tell how it feels to play because of that. (Verlet physics isn't great at handling rotational constraints.)

My second try was to just move either the hands or feet towards the mouse. That works better, especially with a bit of code to prevent the center of mass from moving. Unfortunately, it makes the rope really springy when you move the mouse around. It's too hard to play.

For a third try, I went back to the original method of just adding a force towards the mouse. Applying the force to the hands or feet works fairly well, but doesn't give much control over doing flips and the like.

For the moment, I'm trying to apply a force on the hand or feet towards the mouse, and a force on the joint away from the mouse. This should give the player some ability to flip without making the rope too bouncy or other such errors. Now I've just got to get the numbers right.

Using the Verlet physics does miss one thing though. Raising your arms should increase your moment of inertia, which makes you spin more slowly. The Verlet ragdoll model doesn't track moment of inertia explicitly, and I don't know if it works implicitly. I suppose it doesn't matter too much, since you'd probably want to control both the arms and legs to really take advantage of something like that.

No comments: