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.




On Wed, Oct 14, 2009 at 3:21 PM, Adam "amckern" McKern <[email protected]>wrote:

> Its possible, but very hard to get going - though i did not change the
> view, i did make it so that your movement is dependent on shooting weapons
> in a ZeroG environment
>
> http://www.nigredostudios.com/prime/screenshots/zerog0002.jpg
>
> --------
> Owner Nigredo Studios http://www.nigredostudios.com
>
> --- On Thu, 15/10/09, Tony Paloma <[email protected]> wrote:
>
> From: Tony Paloma <[email protected]>
> Subject: Re: [hlcoders] Arbitrary Gravity Direction
> To: "'Discussion of Half-Life Programming'" <
> [email protected]>
> Received: Thursday, 15 October, 2009, 4:08 AM
>
> IPhysicsEnvironment has a function called SetGravity that takes a Vector.
> You can use it to set an arbitrary direction for gravity, but it will work
> for VPhysics objects only. I didn't check if this information was in that
> thread you posted. Sorry if it was.
>
> If you have an instance of VPHYSICS_INTERFACE_VERSION, you can get the
> environment by:
> pPhysics->GetActiveEnvironmentByIndex(0);
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
> Sent: Wednesday, October 14, 2009 6:39 AM
> To: [email protected]
> Subject: Re: [hlcoders] Arbitrary Gravity Direction
>
> See this thread for a discussion and partial implementation of arbitrary
> gravity direction.
> http://forums.steampowered.com/forums/showthread.php?t=778484
>
> I never got it working entirely right, and gave up on it anyway :)
> And it never did props.
>
> --
> This message was sent on behalf of [email protected] at openSubscriber.com
>
> http://www.opensubscriber.com/message/[email protected]/129248
> 43.html<http://www.opensubscriber.com/message/[email protected]/129248%0A43.html>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
>
>
>
>  
> __________________________________________________________________________________
> Get more done like never before with Yahoo!7 Mail.
> Learn more: http://au.overview.mail.yahoo.com/
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to