PxVehicleUpdate.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2017 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-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com