PCar is a powerful, ready-to-use vehicle you can use in your 3D Rad projects. Physics is entirely based on the NVIDIA® PhysX™ vehicle simulation.
PCar basic usage is similar to that of the legacy Car object, but the internal functionality has been rewritten to fully and closely support the simulation features provided by the NVIDIA® PhysX™ libraries.
The property dialog for the PCar object allows you to configure car physics parameters like maximum wheel axle torque, suspension spring/damping, etc, and even specify longitudal and lateral tire force functions independently, to accurately simulate specific tire designs.
Even more powerful functionality is provided through internal PCar object parameters that can be altered run-time by using scripting or other 3D Rad objects.
Additional parameters are also provided in a car-model-specific .ini file, which defines the basic parameters, like car-body and wheel masses, that differentiate each vehcle type that you can find in the included car layout library.
All cars in the library (see Change, below) have default wheel locations and size. You can alter these by specifying X, Y, Z offsets in meters and a scaling factor (1.0 means original size).
Keep in mind that the wheel location, specified as above, is actually the position of the wheel when the suspension is fully compressed.
This means that the actual wheel position, both in the editor window and run-time, will also depend on the Suspension travel parameter (see below).
Click the Change button to access the library of available car layouts.
Because changing car layout also changes vehicle size and weight, you will likely need to adjust maximum wheel torque, suspension strength and vehicle center of mass offset to achieve the desired car physics behavior.
If this option is checked, a faster rendering technique is used for the placeholder geometry. This will improve frame rate on slower systems, but it may reduce rendering quality.
If this option is checked, the car layout will cast a volumetric shadow. This may affect frame rate on slower systems.
Set this parameter to any positive value (below 450.0) to make the placeholder geometry dynamically reflect the actual environment surrounding it.
If this option is checked the car-body placeholder geometry will not be rendered, run-time.
If this option is checked the wheels' placeholder geometry will not be rendered run-time.
You can make the car interactive by checking the box next to one or more input controls (Throttle, Reverse, Brake, Turn Left/Right).
NOTE: you can allow the final users of your project to configure controls (eg to use a steering wheel) by adding a ConfigureControls object to the project.
The Delay parameters allow you to set the response time for each control, in seconds (approximately).
Also, keep in mind that input controls must be disabled (unchecked) if you want to control the car by manipulating its internal values, for example by using the Script object. See internal values table below for more.
A complete set of parameters is provided for front and rear wheels independently.
When the suspension is compressed beyond the target position, it behaves more like a simple spring, rather than a vehicle suspension. As a result it produces some extra bouncing that can be used to simulate old times vehicles or faulty suspensions.
Please note that the specified speed is theoretical (it assumes infinite axle torque and grip force). It means that, due to various factors, including default damping applied to car model's rigid-bodies, the simulated car may stop accelerating well before the specified speed.
Note: a more realistic way to simulate drag is by attachng an Airfoil object to the car.
NOTE: setting the center of mass too low will make the car bend the opposite way, like a motorbike, on bends. This effect is useful when implementing motorbikes (you usually also alter the Car wheel X offset so that left and right wheel sets join together in the middle).
As soon as a tire slips on the ground, a certain grip force is generated to simulate rubber friction.
The maximum amount of longitudal and lateral force can be adjusted primarily by using the Max longitudal/lateral grip parameters mentioned above (Wheel parameters section).
However, because real-world tires produce different amounts of grip force depending on how fast they slip, the PCar object includes, for a more realistic simulation, some extra parameters.
The graph above is the amount of tire force (grip) produced, for a given slip velocity (in meters per second).
For real cars, experimental data shows that force reaches its maximum when slip speed is about 1 meter per second. It then progressively diminishes and stabilizes at a lower level, when slip reaches a certain, higher speed.
The Extremum slip/force parameters let you specify where, on the graph, the extremum point is (that is, at what slip speed, the tire will produce the specified force).
Note that slip speed is in meters per second.
Also note that when the specified tire force is 1, the amount of grip produced is the one you specified in the Max longitudal grip box (Wheel parameters section above), when force is 2, grip is twice the amount of grip specified and so on.
Similarly, the Asymptote slip/force parameters let you specify where, on the graph, the asymptote point is (that is, at what slip speed, the tire force will stabilize at the specified value).
Note that, due to tire rubber design and other factors, real-world longitudal and lateral grip may be described by different curves. For your simulated car you can therefore specify different tire force functions for longitudal and lateral slip.
NOTE: due to user interface limitations, you can only specify tire force functions for both front and rear wheels, on the PCar property dialog. This limitiation is not there when manipulating parameters by using scripting (see below).
In a multiplayer game, when the project is running on the server, PCar objects that have controls sets to the same Network ID as EventOnInput objects in a project which is running on a connected client PC, will respond based on the remote user input.
So, for example, if you have a car game running on the server, and the controls of a PCar are associated with (have the same Network Id as) EventOnInput objects in a project running on a client, the client PC user will be able to control the PCar on the server.
IMPORTANT: the PCar controls you want to be controlled by a remote EventOnInput object must be disabled (un-ckecked) on the PCar property dialog. Simply setting a network Id for a control will give no results if the control is enabled (checked) on the PCar property dialog.
For more information about creating multiplayer projects with 3D Rad, please see the EventOnInput help file (NETWORK section).
For information about the remaining controls, please click here.
The following internal parameters can be accessed by using other objects like EventOnValue or Script:
The following internal parameters can be accessed by using the Script object. Please note that resetting the PCar object run-time (for example by calling the iObjectReset() script function) will not restore these parameters to their default values.
Almost all the remaining parameters present on the property dialog can be controlled run-time by using the iObjectParamSet() script function. For an example of usage and a complete list of settings, please see the sample project called PCarScriptedDemo.3dr (in 3D Rad, press Ctrl+O to access available demo projects).