[Tutorial]Enabling vehicles.

Page 10 of 16 FirstFirst ... 2345678910111213141516 LastLast
Results 136 to 150 of 239
  1. #136
    Account Upgraded | Title Enabled! CodexPo is offline
    MemberRank
    May 2013 Join Date
    BilbaoLocation
    574Posts

    Re: [Tutorial]Enabling vehicles.

    now yes, i replace this:

    Code:
    vd->vehicle->setup(g_pPhysicsWorld->PhysXSDK, vehActor, *wheelsData, driveData, std::max<int>(vd->numWheels - 4, 0));
    
    vd->vehicle->setWheelShapeMapping(0, 4 - 4); 
    vd->vehicle->setWheelShapeMapping(1, 5 - 4); 
    vd->vehicle->setWheelShapeMapping(2, 6 - 4); 
    vd->vehicle->setWheelShapeMapping(3, 7 - 4);
    to this

    Code:
        if (m->FileName == "data/objectsdepot/vehicles/drivable_stryker.sco") {
            vd->vehicle->setup(g_pPhysicsWorld->PhysXSDK, vehActor, *wheelsData, driveData, std::max<int>(vd->numWheels, 0));
            vd->vehicle->setWheelShapeMapping(0, 0);
            vd->vehicle->setWheelShapeMapping(1, 1);
            vd->vehicle->setWheelShapeMapping(2, 2);
            vd->vehicle->setWheelShapeMapping(3, 3);
            vd->vehicle->setWheelShapeMapping(4, 4);
            vd->vehicle->setWheelShapeMapping(5, 5);
            vd->vehicle->setWheelShapeMapping(6, 6);
            vd->vehicle->setWheelShapeMapping(7, 7);
    
        }
        else {
            vd->vehicle->setup(g_pPhysicsWorld->PhysXSDK, vehActor, *wheelsData, driveData, std::max<int>(vd->numWheels-4, 0));
            vd->vehicle->setWheelShapeMapping(0, 0);
            vd->vehicle->setWheelShapeMapping(1, 1);
            vd->vehicle->setWheelShapeMapping(2, 2);
            vd->vehicle->setWheelShapeMapping(3, 3);
        }


    Last edited by CodexPo; 11-09-13 at 07:20 PM.

  2. #137
    Holy mother jesus tractor Kratos147 is offline
    MemberRank
    Jan 2011 Join Date
    CroatiaLocation
    470Posts

    Re: [Tutorial]Enabling vehicles.

    sexy as hell.

  3. #138
    Account Upgraded | Title Enabled! jonnybravo is offline
    MemberRank
    Sep 2006 Join Date
    773Posts

    Re: [Tutorial]Enabling vehicles.

    still alot to do to bring it to the serve side and your missing alot of stuff inside some files i should frap my Air C130 Gunship or the tank..


  4. #139
    Account Upgraded | Title Enabled! CodexPo is offline
    MemberRank
    May 2013 Join Date
    BilbaoLocation
    574Posts

    Re: [Tutorial]Enabling vehicles.

    and that tank??? :O




    you've gotten it to work 100% of cars?

  5. #140
    Account Upgraded | Title Enabled! jonnybravo is offline
    MemberRank
    Sep 2006 Join Date
    773Posts

    Re: [Tutorial]Enabling vehicles.

    yes.. only 2 bugs tho..

    if 2 people are inside one vehicle they can both control it and player to player update between both objects to show that the player is using the object..

  6. #141
    Account Upgraded | Title Enabled! CodexPo is offline
    MemberRank
    May 2013 Join Date
    BilbaoLocation
    574Posts

    Re: [Tutorial]Enabling vehicles.

    and you could not share the code to make it work 100%?

  7. #142
    Account Upgraded | Title Enabled! Poster13 is offline
    MemberRank
    Jun 2013 Join Date
    395Posts

    Re: [Tutorial]Enabling vehicles.

    Quote Originally Posted by jonnybravo View Post
    yes.. only 2 bugs tho..

    if 2 people are inside one vehicle they can both control it and player to player update between both objects to show that the player is using the object..
    Jonny please write your code? how to added obj_VenicleSpawn on WO Server,)) Please))

  8. #143
    Account Upgraded | Title Enabled! CodexPo is offline
    MemberRank
    May 2013 Join Date
    BilbaoLocation
    574Posts

    Re: [Tutorial]Enabling vehicles.

    Fix camera when Spawn car

    Search on HUD_TPSGame.cpp

    Code:
    wasDrivenByPlayer = true;
    replace with this

    Code:
                if(Keyboard->WasPressed(kbsE))
                   wasDrivenByPlayer = true;

  9. #144
    Enthusiast LziNN is offline
    MemberRank
    May 2013 Join Date
    localhostLocation
    40Posts

    Re: [Tutorial]Enabling vehicles.

    Quote Originally Posted by jonnybravo View Post
    yes.. only 2 bugs tho..

    if 2 people are inside one vehicle they can both control it and player to player update between both objects to show that the player is using the object..
    Jonny, we're so close to making the big .. Please share with us .. Many stopped of share, do not know why. But I know that there is still something good between us.!

  10. #145
    Enthusiast Leandro Lima is offline
    MemberRank
    May 2013 Join Date
    41Posts

    Re: [Tutorial]Enabling vehicles.

    Quote Originally Posted by CodexPo View Post
    Fix camera when Spawn car

    Search on HUD_TPSGame.cpp

    Code:
    wasDrivenByPlayer = true;
    replace with this

    Code:
                if(Keyboard->WasPressed(kbsE))
                   wasDrivenByPlayer = true;
    Quote Originally Posted by jonnybravo View Post
    still alot to do to bring it to the serve side and your missing alot of stuff inside some files i should frap my Air C130 Gunship or the tank..

    thanks for sharing your work

    Quote Originally Posted by LziNN View Post
    Jonny, we're so close to making the big .. Please share with us .. Many stopped of share, do not know why. But I know that there is still something good between us.!
    yes. some people stopped share or pessoals advances that has no more shares. I'm solving po example other problems in my server, so it ends see what I can do

  11. #146
    Member Novoc is offline
    MemberRank
    May 2013 Join Date
    ThailandLocation
    98Posts

    Re: [Tutorial]Enabling vehicles.

    To fix crashing when exiting vehicle (maybe this has already been said?)

    in HUD_TPSGame.cpp

    Before
    Code:
            // vehicles        if(InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_INTERACT) )
            {
    #if VEHICLES_ENABLED
                obj_Vehicle* target_Vehicle = pl->canEnterVehicle();
            
                if( pl->isInVehicle() ) {
                    pl->exitVehicle();
                }
                else if ( target_Vehicle  ) // now we're going to try to use vehicles (otherwise UAV characters can't use vehicles).
                {
                    pl->enterVehicle( target_Vehicle );
                }
    #endif
            }
    After
    Code:
            // vehicles
            if(InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_INTERACT) )
            {
    #if VEHICLES_ENABLED
                if( pl->isInVehicle() )
                {
                    pl->exitVehicle();
                }
                else
                {
                    obj_Vehicle* target_Vehicle = pl->canEnterVehicle();
    
    
                    if ( target_Vehicle  ) // now we're going to try to use vehicles (otherwise UAV characters can't use vehicles).
                        pl->enterVehicle( target_Vehicle );
                }
    #endif
            }

    in AI_Player.cpp

    Before
    Code:
    void obj_Player::exitVehicle()
    {
    
    
        // first let's look for a good location
        obj_Vehicle* currentCar = g_pPhysicsWorld->m_VehicleManager->getRealDrivenVehicle();
        r3d_assert(currentCar);
    
    
    
    
        r3dVector rotationVector = currentCar->GetRotationVector();
        r3dMatrix Matrix;
        // NOTE: We might want to take out rotation in the x or z direction and only focus on the Y direction... 
        r3dBuildRotationMatrix(Matrix, rotationVector );
    
    
        bool success = false;
        for ( int exitIndex = 0; exitIndex < 4; exitIndex++  )
        {
            r3dVector exitPosition;
            bool returnValue = currentCar->getExitSpace( exitPosition, exitIndex );
            r3d_assert( returnValue );
    
    
            exitPosition *= Matrix;
            r3dVector targetPosition = currentCar->GetPosition() + exitPosition; 
    
    
            if ( TestExitPosition( targetPosition) )
            {
                TeleportPlayer( targetPosition, "Exiting vehicle");
                success = true;
                break;
            }
        }
    After
    Code:
    void obj_Player::exitVehicle()
    {
        // first let's look for a good location
        obj_Vehicle* currentCar = g_pPhysicsWorld->m_VehicleManager->getRealDrivenVehicle();
        r3d_assert(currentCar);
    
    
        r3dVector rotationVector = currentCar->GetRotationVector();
        r3dMatrix Matrix;
        // NOTE: We might want to take out rotation in the x or z direction and only focus on the Y direction... 
        r3dBuildRotationMatrix(Matrix, rotationVector );
    
    
        bool success = false;
        for ( int exitIndex = 0; exitIndex < 4; exitIndex++  )
        {
            r3dVector exitPosition;
            bool returnValue = currentCar->getExitSpace( exitPosition, exitIndex );
            // r3d_assert( returnValue );
    
    
            if( !returnValue )
                continue;
    
    
            exitPosition *= Matrix;
            r3dVector targetPosition = currentCar->GetPosition() + exitPosition; 
    
    
            if ( TestExitPosition( targetPosition) )
            {
                TeleportPlayer( targetPosition, "Exiting vehicle");
                success = true;
                break;
            }
        }

  12. #147
    Account Upgraded | Title Enabled! Poster13 is offline
    MemberRank
    Jun 2013 Join Date
    395Posts

    Re: [Tutorial]Enabling vehicles.

    Quote Originally Posted by Novoc View Post
    To fix crashing when exiting vehicle (maybe this has already been said?)

    in HUD_TPSGame.cpp

    Before
    Code:
            // vehicles        if(InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_INTERACT) )
            {
    #if VEHICLES_ENABLED
                obj_Vehicle* target_Vehicle = pl->canEnterVehicle();
            
                if( pl->isInVehicle() ) {
                    pl->exitVehicle();
                }
                else if ( target_Vehicle  ) // now we're going to try to use vehicles (otherwise UAV characters can't use vehicles).
                {
                    pl->enterVehicle( target_Vehicle );
                }
    #endif
            }
    After
    Code:
            // vehicles
            if(InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_INTERACT) )
            {
    #if VEHICLES_ENABLED
                if( pl->isInVehicle() )
                {
                    pl->exitVehicle();
                }
                else
                {
                    obj_Vehicle* target_Vehicle = pl->canEnterVehicle();
    
    
                    if ( target_Vehicle  ) // now we're going to try to use vehicles (otherwise UAV characters can't use vehicles).
                        pl->enterVehicle( target_Vehicle );
                }
    #endif
            }

    in AI_Player.cpp

    Before
    Code:
    void obj_Player::exitVehicle()
    {
    
    
        // first let's look for a good location
        obj_Vehicle* currentCar = g_pPhysicsWorld->m_VehicleManager->getRealDrivenVehicle();
        r3d_assert(currentCar);
    
    
    
    
        r3dVector rotationVector = currentCar->GetRotationVector();
        r3dMatrix Matrix;
        // NOTE: We might want to take out rotation in the x or z direction and only focus on the Y direction... 
        r3dBuildRotationMatrix(Matrix, rotationVector );
    
    
        bool success = false;
        for ( int exitIndex = 0; exitIndex < 4; exitIndex++  )
        {
            r3dVector exitPosition;
            bool returnValue = currentCar->getExitSpace( exitPosition, exitIndex );
            r3d_assert( returnValue );
    
    
            exitPosition *= Matrix;
            r3dVector targetPosition = currentCar->GetPosition() + exitPosition; 
    
    
            if ( TestExitPosition( targetPosition) )
            {
                TeleportPlayer( targetPosition, "Exiting vehicle");
                success = true;
                break;
            }
        }
    After
    Code:
    void obj_Player::exitVehicle()
    {
        // first let's look for a good location
        obj_Vehicle* currentCar = g_pPhysicsWorld->m_VehicleManager->getRealDrivenVehicle();
        r3d_assert(currentCar);
    
    
        r3dVector rotationVector = currentCar->GetRotationVector();
        r3dMatrix Matrix;
        // NOTE: We might want to take out rotation in the x or z direction and only focus on the Y direction... 
        r3dBuildRotationMatrix(Matrix, rotationVector );
    
    
        bool success = false;
        for ( int exitIndex = 0; exitIndex < 4; exitIndex++  )
        {
            r3dVector exitPosition;
            bool returnValue = currentCar->getExitSpace( exitPosition, exitIndex );
            // r3d_assert( returnValue );
    
    
            if( !returnValue )
                continue;
    
    
            exitPosition *= Matrix;
            r3dVector targetPosition = currentCar->GetPosition() + exitPosition; 
    
    
            if ( TestExitPosition( targetPosition) )
            {
                TeleportPlayer( targetPosition, "Exiting vehicle");
                success = true;
                break;
            }
        }
    NICE)) Thanks!

    Friends how to fix???


  13. #148
    Enthusiast maxmaz9 is offline
    MemberRank
    Apr 2013 Join Date
    THAILANDLocation
    44Posts

    Re: [Tutorial]Enabling vehicles.



    can you help me?

  14. #149
    Account Upgraded | Title Enabled! CodexPo is offline
    MemberRank
    May 2013 Join Date
    BilbaoLocation
    574Posts

    Re: [Tutorial]Enabling vehicles.

    this is optional, if you not like old block blue for spawns and like more how zombie spawns replace this.

    obj_VehicleSpawn.cpp

    OLD CODE

    Code:
    void obj_VehicleSpawn::DoDraw()
    {
    #ifndef FINAL_BUILD
    #if VEHICLES_ENABLED
        if( g_Manipulator3d.IsSelected(this) || ( spawnedVehicle != NULL && g_Manipulator3d.IsSelected(spawnedVehicle)) )
    #else
        if( g_Manipulator3d.IsSelected(this) )
    #endif
        {
            r3dColor clr = r3dColor::blue;
            r3dRenderer->SetRenderingMode( R3D_BLEND_ALPHA | R3D_BLEND_ZC );
    
            clr.A = 196;
            r3dBoundBox localBBox = GetBBoxLocal();
            r3dBoundBox bbox;
            bbox.Org = GetPosition();// - 0.5f * m_bboxSize;
            bbox.Org.y += .5f * localBBox.Size.y ;
            bbox.Size = localBBox.Size;
    
            r3dVector rotation = GetRotationVector();
            // there's a bug with rotation so I've to swap the axis.
            float temp;
            temp = rotation.y;
            rotation.y = rotation.x;
            rotation.x = temp;
    
            r3dDrawOrientedBoundBox( bbox, rotation, gCam, clr );
    
            // r3dDrawUniformSphere ( GetPosition(), m_maxDist, gCam, clr );
            r3dRenderer->Flush();
        }
    #endif
    }
    NEW CODE

    Code:
    void obj_VehicleSpawn::DoDraw()
    {
    //#ifndef FINAL_BUILD
    #if VEHICLES_ENABLED
    /*    if( g_Manipulator3d.IsSelected(this) || ( spawnedVehicle != NULL && g_Manipulator3d.IsSelected(spawnedVehicle)) )
    #else
        if( g_Manipulator3d.IsSelected(this) )
    #endif
        {*/
            r3dColor clr = r3dColor::blue;
            r3dRenderer->SetRenderingMode( R3D_BLEND_ALPHA | R3D_BLEND_ZC );
    
            clr.A = 196;
            r3dBoundBox localBBox = GetBBoxLocal();
            r3dBoundBox bbox;
            bbox.Org = GetPosition();// - 0.5f * m_bboxSize;
            bbox.Org.y += .5f * localBBox.Size.y ;
            bbox.Size = localBBox.Size;
    
            r3dVector rotation = GetRotationVector();
            // there's a bug with rotation so I've to swap the axis.
            float temp;
            temp = rotation.y;
            rotation.y = rotation.x;
            rotation.x = temp;
    
            r3dDrawLine3D(GetPosition(), GetPosition() + r3dPoint3D(0, 20.0f, 0), gCam, 0.4f, r3dColor(242, 64, 0));
            r3dDrawCircle3D(GetPosition(), 2.0f, gCam, 0.4f, r3dColor(242, 255, 0));
            r3dRenderer->Flush();
    /*    }*/
    #endif
    }
    example shot


  15. #150
    Account Upgraded | Title Enabled! Poster13 is offline
    MemberRank
    Jun 2013 Join Date
    395Posts

    Re: [Tutorial]Enabling vehicles.

    Thanks))



Advertisement