March 01, 2023

Vehicle Physics 

With the release of Evergine, developers can now easily create Vehicle Physics simulations. The vehicle physics model is simplified, eliminating the need to simulate each wheel and chassis as separate rigid bodies connected by Joints. Instead, the entire vehicle is represented as a single Rigid Body, which not only simplifies the physics model but also improves performance. 

 To simulate the collision detection of the wheels, Evergine uses ray-casting, which approximates the behavior of real-world vehicles. This solution also accurately simulates the friction between the tire and the surface. 

Developers have a lot of flexibility to create different types of vehicles with an arbitrary number of wheels, suspension properties, rotation axis, and more. This allows for the creation of realistic and complex vehicle simulations. 

To get started with vehicle physics in Evergine, developers need to use two components: PhysicVehicle3D and PhysicWheel3D. 

 

PhysicsVehicle3D component 

 PhysicVehicle3D component should be added to the chassis rigid body that the developer wants to turn into a vehicle.  This component will apply forces to the physics body to simulate the suspension, engine torque, and brake forces.  

Useful properties 

The following properties can be used to customize your vehicle: 

  • SuspensionStiffness: Suspension stiffness is a measure of how much force is required to compress the suspension of a vehicle. 
  • SuspensionCompression: This property determines how much the suspension will compress when the wheel hits a bump or obstacle. 
  • SuspensionCompression: This property determines the rate at which the suspension spring will compress and rebound. It controls the amount of damping force that is applied to the suspension when the vehicle encounters bumps or uneven terrain. 
  • MaxSuspensionTravel: It represents the maximum distance that the suspension can be compressed or extended. It is measured in units of length. 
  • FrictionSlip: It refers to the amount of slip that occurs between the tire and the ground during motion. Friction slip is typically modeled using a friction coefficient that represents the ratio of the tangential force to the normal force between the tire and the ground. This coefficient can be adjusted to simulate different levels of slip and traction for different types of vehicles and surfaces. 
  • MaxSuspensionForce: Specifies the maximum force that the suspension can apply to the chassis of the vehicle. It is used to limit the effect of the suspension when it is compressed or stretched, preventing the vehicle from bouncing too much or losing stability. 

Control the vehicle! 

If you wish to commence operating the vehicle, the following methods may prove to be useful: 

  • ApplyEngineForce(force): This method is used to apply the engine force that will be applied to the vehicle. This can be adjusted to increase or decrease the speed of the vehicle, and it can be set to a negative value to go backwards. The engine force will be applied only to the drive wheels. 
  • SetSteeringValue(steering): This method is used to set the steering angle of the vehicle. Use this method to change the vehicle direction. The steering value is only applied to steerable wheels. 
  • SetBrake(brake): Indicates the brake force applied by the vehicle. The steering value is only applied to breakable wheels. 

Physic Wheel component 

PhysicWheel3D component should be added to each entity that the developer wants to act as a wheel for the vehicle.  

The following properties help to define how the wheel directions of suspension and rotation, among other things: 

  • WheelRadius: Determines the wheel radius.  
  • RotationAxis: Is used to define the axis around which the wheel rotates. It also indicates the advanced direction when applying engine force. It is specified in the local space of the wheel entity. 
  • SuspensionDirection: Indicates the direction in which the wheel’s suspension operates. It also defines the steering wheel direction. It is specified in the local space of the wheel entity. 
  • SuspensionRestLength: Defines the length of the wheel’s suspension when the vehicle is in its resting position. 

Conclusions 

The PhysicVehicle3D and PhysicWheel3D components are fully integrated with the Evergine physics system. This means that developers can take advantage of all the features and capabilities of the Evergine physics engine when creating their vehicle simulations. 

In conclusion, Evergine’s vehicle physics model simplifies the process of creating vehicle simulations by allowing developers to represent the entire vehicle as a single Rigid Body. This approach not only simplifies the physics model but also improves performance. Developers have a lot of flexibility to create different types of vehicles with customizable properties, making it possible to create realistic and complex vehicle simulations. The PhysicVehicle3D and PhysicWheel3D components are fully integrated with Evergine’s physics engine, making it easy for developers to take advantage of all the features and capabilities of the engine. With this new release, Evergine is making it easier than ever for developers to create high-quality vehicle simulations. 

David avila
Author
David Ávila
Plain Concepts Research

Wait! Don't leave yet.

Sign up for our monthly newsletter to be updated on all the latest news, case studies, and more.

We don't send spam and you can unsubscribe at any time.