Aargh... I had wanted to do something like this, with triggers that set a gravity direction and strength while you were within them, like a VPhysics trigger. They're fun. Well, looking at your post, I believe that there's no way in the world that I would ever understand anything close to this.
> This is very very possible. > > Objectives and problems you have to overcome to meet this goal: > > > - Use Quaternions to break Gimbal Locking (happens with Matrix and Euler > Angles). You can download a nice set of Quaternion functions from Ogre > Engine (free download) and with some slight tweaks they will work on > Source. Quaternions are basically an Up Direction (vector), and an Angle > (float). There is a function called "Slerp" that will let you smoothly > orient between 2 quaternions. There are multiple ways to create > Quaternions > using Matrices or Vectors. > > > - You'll have to keep a new vector that saves your "gravity direction". > If you want to orient automatically you'll need to constantly trace > downwards along your gravity direction and based on the new Ground Normal, > allow orientation or not. > > > - Source uses AABB which means your player box will never rotate, ever. > This causes a problem with your origin. When you rotate onto a wall, your > origin will be much closer to the ground than before. Simply hack around > this by adjusting your RenderOrigin up X units off the ground (when you are > on it of course). > > > - Jumping was one of the bigger problems I first encountered. This is > better suited for orientations based on events, if you want automatic > orientation based on the ground the player is on, you'll need to have > multiple traces of different lengths to make sure you maintain the correct > orientation. You can also trigger going to a default gravity if you are in > the air too long or the ground your over is to complicated or is orienting > too fast. > > > - You'll have to orient your models correctly. Models use Euler Angles > for orientation, so if you use Quaternions, you'll have to convert to > Matrix > and then to Euler Angles. Not such a biggy, but Euler angles were never > meant for 6 degrees of freedom usage. If you want to use them, only use > them > in the local world space where everything is oriented at (0,0,1). Then > convert to world space. > > > - Wall collision is another big problem you will encounter. Since you > won't have the luxury of using the players bounding box for tracing, you'll > have to be accurate with line traces. I constantly found myself getting > knocked off the ground because of odd terrain. Stairs is another wall > collision problem you have to face. This requires more line traces going > in > your movement direction starting from the top of your player model to the > middle and so on. You have to make sure you can actually move forward if > not > you'll get yourself stuck in the terrain. > > > - Other Entities is the last problem. So far you've only managed the > players. Now you have to manage all other entity objects. You'll have to > follow the same basic principles as the player orientation depending on > what > your entities do. Physics entities have to all orient based on the same > gravity direction, if you want each one to have it's own orientation, > you'll > need to work with the physics interface. This requires managing the > angular > velocity and linear velocity. This is more complicated, and if you can > pull off the player orientation, you should be able to figure a way to do > this. It would make for an awesome game though. Imagine a 1024 cube... Here's looking forward to Ballmanmod. Oh, and I recall that someone was asking why anti-gravity was not working somewhere before. It's because gravity is frozen for the player if they are standing on something - just try setting negative gravity with sv_gravity. Nothing happens to you if you're on the floor. _________________________________________________________________ Use Messenger in your Hotmail inbox Find out how here http://windowslive.ninemsn.com.au/article.aspx?id=823454 _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders