IPhysicsMotionController - Anyone Familiar?

Grab your favourite IDE and tinker with the innards of game engines

IPhysicsMotionController - Anyone Familiar?

Postby Lord Ned on Fri Apr 01, 2011 7:33 am

Anyone used one of these before? It's seen in the npc_rollermine.cpp,
Code: Select all
class CRollerController : public IMotionEvent
{
   DECLARE_SIMPLE_DATADESC();

public:
   IMotionEvent::simresult_e Simulate( IPhysicsMotionController *pController, IPhysicsObject *pObject, float deltaTime, Vector &linear, AngularImpulse &angular );
   
   AngularImpulse      m_vecAngular;
   Vector            m_vecLinear;

   void            Off( void )      { m_fIsStopped = true; }
   void            On( void )      { m_fIsStopped = false; }

   bool            IsOn( void )   { return !m_fIsStopped; }

private:
   bool            m_fIsStopped;
};
IMotionEvent::simresult_e CRollerBallController::Simulate(IPhysicsMotionController *pController, IPhysicsObject *pObject, float deltaTime, Vector &linear, AngularImpulse &angular)
{
   if( m_fIsStopped )
   {
      return SIM_NOTHING;
   }

   linear = m_vecLinear;
   angular = m_vecAngular;

   return IMotionEvent::SIM_LOCAL_ACCELERATION;
}



That being said I'm having a hard time figuring out how to use this thing to push an object around. I'd like to wire it up to WASD, and I'm in a position where I can do something like:
Code: Select all
if ( pMoveData->m_nButtons & IN_FORWARD )
   {
      m_RollerBallController.m_vecLinear = Vector( 0, 500, 0 );
   }


And that'll make it roll in some sort of... circle looking thing. However I'm not really following what's going on here so if someone could explain it in some simpler english that'd be helpful. :)

Also i can change m_vecLinear (which is a Vector) and m_vecAngular (which is an AngularImpulse), both seem to have a realtime effect.
Resident Source Guru, Competent Level Designer, Talented Artist, Horrible Speller
User avatar
Lord Ned
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Thu Jul 17, 2008 8:42 pm

Return to Programming

Who is online

Users browsing this forum: No registered users

cron