PxVehicleUpdate.h

Go to the documentation of this file.
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 //
00026 // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  
00029 
00030 #ifndef PX_VEHICLE_UPDATE_H
00031 #define PX_VEHICLE_UPDATE_H
00032 
00036 #include "vehicle/PxVehicleSDK.h"
00037 #include "vehicle/PxVehicleTireFriction.h"
00038 #include "foundation/PxSimpleTypes.h"
00039 #include "foundation/PxMemory.h"
00040 #include "foundation/PxTransform.h"
00041 #include "PxBatchQueryDesc.h"
00042 
00043 #if !PX_DOXYGEN
00044 namespace physx
00045 {
00046 #endif
00047 
00048     class PxBatchQuery;
00049     class PxContactModifyPair;
00050     class PxVehicleWheels;
00051     class PxVehicleDrivableSurfaceToTireFrictionPairs;
00052     class PxVehicleTelemetryData;
00053 
00059     struct PxWheelQueryResult
00060     {
00061         PxWheelQueryResult()
00062         {
00063             PxMemZero(this, sizeof(PxWheelQueryResult));
00064             isInAir=true;
00065             tireSurfaceType = PxU32(PxVehicleDrivableSurfaceType::eSURFACE_TYPE_UNKNOWN);
00066             localPose = PxTransform(PxIdentity);
00067         }
00068 
00074         PxVec3 suspLineStart;
00075 
00081         PxVec3 suspLineDir;
00082 
00088         PxReal suspLineLength;
00089 
00096         bool isInAir;
00097 
00103         PxActor* tireContactActor;
00104 
00110         PxShape* tireContactShape;
00111 
00117         const PxMaterial* tireSurfaceMaterial;
00118 
00128         PxU32 tireSurfaceType;
00129 
00135         PxVec3 tireContactPoint;
00136 
00142         PxVec3 tireContactNormal;
00143 
00152         PxReal tireFriction;
00153 
00162         PxReal suspJounce;
00163 
00171         PxReal suspSpringForce;
00172 
00179         PxVec3 tireLongitudinalDir;
00180 
00187         PxVec3 tireLateralDir;
00188 
00197         PxReal longitudinalSlip;
00198 
00207         PxReal lateralSlip;
00208 
00213         PxReal steerAngle;
00214 
00218         PxTransform localPose;
00219     };
00220 
00221     struct PxVehicleWheelQueryResult
00222     {
00231         PxWheelQueryResult* wheelQueryResults;
00232 
00237         PxU32 nbWheelQueryResults;
00238     };
00239 
00246     struct PxVehicleWheelConcurrentUpdateData
00247     {
00248         friend class PxVehicleUpdate;
00249 
00250         PxVehicleWheelConcurrentUpdateData()
00251             : localPose(PxTransform(PxIdentity)),
00252               hitActor(NULL),
00253               hitActorForce(PxVec3(0,0,0)),
00254               hitActorForcePosition(PxVec3(0,0,0))
00255         {
00256         }
00257 
00258     private:
00259 
00260         PxTransform localPose;
00261         PxRigidDynamic* hitActor;
00262         PxVec3 hitActorForce;
00263         PxVec3 hitActorForcePosition;
00264     };
00265 
00273     struct PxVehicleConcurrentUpdateData
00274     {
00275         friend class PxVehicleUpdate;
00276 
00277         PxVehicleConcurrentUpdateData()
00278             : concurrentWheelUpdates(NULL),
00279               nbConcurrentWheelUpdates(0),
00280               linearMomentumChange(PxVec3(0,0,0)),
00281               angularMomentumChange(PxVec3(0,0,0)),
00282               staySleeping(false),
00283               wakeup(false)
00284         {
00285         }
00286 
00293         PxVehicleWheelConcurrentUpdateData* concurrentWheelUpdates;
00294 
00299         PxU32 nbConcurrentWheelUpdates;
00300 
00301     private:
00302 
00303         PxVec3 linearMomentumChange;
00304         PxVec3 angularMomentumChange;
00305         bool staySleeping;
00306         bool wakeup;
00307     };
00308 
00346     void PxVehicleSuspensionRaycasts
00347         (PxBatchQuery* batchQuery, 
00348          const PxU32 nbVehicles, PxVehicleWheels** vehicles,
00349          const PxU32 nbSceneQueryResults, PxRaycastQueryResult* sceneQueryResults, 
00350          const bool* vehiclesToRaycast = NULL);
00351 
00352 
00408     void PxVehicleSuspensionSweeps
00409         (PxBatchQuery* batchQuery, 
00410          const PxU32 nbVehicles, PxVehicleWheels** vehicles, 
00411          const PxU32 nbSceneQueryResults, PxSweepQueryResult* sceneQueryResults,  const PxU16 nbHitsPerQuery, 
00412          const bool* vehiclesToSweep = NULL,
00413          const PxF32 sweepWidthScale = 1.0f, const PxF32 sweepRadiusScale = 1.0f);
00414 
00447     PxU32 PxVehicleModifyWheelContacts
00448         (const PxVehicleWheels& vehicle, const PxU32 wheelId,
00449         const PxF32 wheelTangentVelocityMultiplier, const PxReal maxImpulse,
00450         PxContactModifyPair& contactModifyPair);
00451 
00452 
00497     void PxVehicleUpdates(
00498         const PxReal timestep, const PxVec3& gravity, 
00499         const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs, 
00500         const PxU32 nbVehicles, PxVehicleWheels** vehicles, PxVehicleWheelQueryResult* vehicleWheelQueryResults, PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL);
00501 
00502 
00515     void PxVehiclePostUpdates(
00516         const PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
00517 
00518 
00535     void PxVehicleShiftOrigin(const PxVec3& shift, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
00536 
00537 #if PX_DEBUG_VEHICLE_ON
00538 
00567     void PxVehicleUpdateSingleVehicleAndStoreTelemetryData
00568         (const PxReal timestep, const PxVec3& gravity, 
00569          const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs, 
00570          PxVehicleWheels* focusVehicle, PxVehicleWheelQueryResult* vehicleWheelQueryResults, 
00571          PxVehicleTelemetryData& telemetryData);
00572 #endif
00573 
00574 #if !PX_DOXYGEN
00575 } // namespace physx
00576 #endif
00577 
00579 #endif //PX_VEHICLE_UPDATE_H


Copyright © 2008-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com