Monday, April 19, 2010

Climbing and Walking

As I was working on the code today, I was trying to make the player start falling when he wasn't colliding with anything.
The problem, however, is that some collision functions are still a little broken, so I had to work on something else.
Bruce was working on the transition between walking and climbing states. Since the player will be colliding with both the ground and the floor at the same time, we don't want him to start going crazy because, every frame, he would be changing from walking to climbing and back to walking.
He wanted to find out a way so that when the player went from one surface to another, he would face away from the wall.
I thought about it and gave him this idea:
Make the player's forward vector equal to his previous Y axis. Then, rotate himself around the X axis an amount so that his Y axis becomes parallel to the new surface's normal.
Here's a drawing that describes my thought process:




EDIT: After checking this, we realized that, in some cases, rotating around the X won't work, sometimes the rotation would need to be around the Z axis, for example, if the player hits the wall by strafing sideways.

No comments:

Post a Comment