WHAT IS
3D RAD?
CLICK HERE
TO FIND OUT!


PCar


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.



Wheel offsets and scale

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).

Change

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.

Fast rendering

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.

Cast shadows

If this option is checked, the car layout will cast a volumetric shadow. This may affect frame rate on slower systems.

Refl. update rate

Set this parameter to any positive value (below 450.0) to make the placeholder geometry dynamically reflect the actual environment surrounding it.

Hide car-body geometry

If this option is checked the car-body placeholder geometry will not be rendered, run-time.

Hide wheels geometry

If this option is checked the wheels' placeholder geometry will not be rendered run-time.

Controls

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.

  • Max angle determines the maximum turning angle for the front wheels.


  • If the Working At Start option is not checked, the car will only respond to input controls when the object is started by another object, like for example EventOnInput.


  • Wheel parameters

    A complete set of parameters is provided for front and rear wheels independently.

  • Maximum axle torque is the maximum angular force applied to the wheel. Keep in mind that the applied force is always maximum when throttle input controls is non-proportional (e.g., the input control is a computer keyboard key or joystick button). Proportional force is only used when the control is proprtional (like a joystick axis, or steering-wheel-device's pedal). for determines how quickly the car will reach its top speed. Actual speed depends on car masses, damping and other settings.


  • Max brake torque is the maximum angular force applied to the wheel to stop it, when braking controls are used.


  • Max longitudal grip is the maximum tire force applied along the wheel's rolling direction. Raising this value makes the tire less prone to spinning when starting and slipping when braking. It also makes the axle torque more effective, causing the car reach higher top speeds. See also Longitudal tire force function, below.


  • Max lateral grip is the maximum tire force applied sideways. Raising this value makes the tire less prone to slipping when turning. See also Lateral tire force function, below.


  • Suspension spring determines suspension force. Raising this value makes the suspension harder to compress. If Suspension damping isn't also raise, the suspension will become more bouncy.


  • Suspension damping determines suspension ability to absorb bounces.


  • Suspension travel is the maximum distance, in meters, the suspension can extend to. When the wheel isn't touching ground, the suspension will extend to the distance specified by this parameter.

  • Suspension target position, between 0 and 1. When this value is zero (default), the maximum suspension force is when the suspenson is fully compressed. When the value is 1, the maximum force is when the suspension is fully extended.



    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.


  • Additional settings

  • Max car speed, in meters per second. When this parameter is non-zero, wheels torque is reduced progressively while the car approaches the specified speed. This can be used to approximately simulate real world cars that don't actually accelerate indefinately, due to drag and internal mechanical frictions.

    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.

  • Reverse torque factor let's you reduce the maximum wheel toques when the car is in reverse. The reverse torque will be the same when this value is 1, half when this value is 0.5 and so on.


  • Center of mass' vertical offset, in meters. For example, -0.7 means that the center of mass for the car will be 0.7 meters lower than the car-body model center. The lower the center of mass, the harder to flip the car on bends.

    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).


  • Crash damping allows you to reduce car speed on collisions. The second value is the threshold speed (in meters per second) for the object hit by the car. If the object's speed is above the threshold, no damping is applied. You typically use this to prevent collisions with other cars or non-static scenery props from triggering crash damping.


  • Longitudal/Lateral tire force function

    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).

    Network IDs for controls / Player number

    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).



    Other dialog controls

    For information about the remaining controls, please click here.


    INTERNAL PARAMETERS


    The following internal parameters can be accessed by using other objects like EventOnValue or Script:

  • Turn left/right, between -1 and 1. Write only
  • Throttle, between -1 and 1. Write only
  • Brake, between 0 and 1. Write only
  • Speed, in meters per second. Read only
  • Maximum steering, in degrees. Read only


  • 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.

  • Brakes state. Read only. This value is 1 when the car is using the brakes, zero otherwise. Note that cars controlled by the CarAI object may almost never brake, unless the Brakes and the Driving carefulness parameters on the CarAI object dialog are bigger than zero
  • Throttle state. Read only. This value is 1 when car throttle is fully activated, zero when it is released and -1 when the car is in full reverse. Intermediate states produce intermediate 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).