Thread: Force and Velocity Physics

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I don't take into account the mass but do the same thing.

    Code:
    void PlayerShip::Thrust()
    {
    
        m_vecVel.x -= (sinf(m_Angle)*1.5f);
        m_vecVel.y += (cosf(m_Angle)*1.5f);
    
    
    }
    
    void PlayerShip::Update(float fTimeDelta)
    {
        m_vecPos.x += (m_vecVel.x * fTimeDelta);
        m_vecPos.y += (m_vecVel.y * fTimeDelta);
        ...
    The - and + in Thrust() are to align my coordinates.

    BTW you should probably divide by mass since a large mass in that posted equation will result in a large overall velocity which is inverse of what should really happen.

    It's F=ma but in this case we are trying to find out the acceleration, not the force. The force being applied is the thrust vector. So the result is A= F/m.
    Last edited by VirtualAce; 12-17-2007 at 01:20 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with gravity engine
    By madmech in forum Game Programming
    Replies: 11
    Last Post: 07-03-2005, 02:41 PM
  2. Question to make you think
    By Darkness in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-05-2005, 07:29 PM
  3. another physics question (momentum)
    By Leeman_s in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 12-23-2003, 05:28 AM