Making Custom Car Physics in Unity (for Very Very Valet)

Toyful Games
8 Jul 202222:48

Summary

TLDRIn this video, the creators of a couch co-op valet game discuss their approach to developing custom car physics in Unity. They explain using a single rigidbody with raycast-based forces for tire interaction, detailing the calculation of suspension, steering, acceleration, and braking forces. The video offers insights into tuning car behavior with simple curves and formulas, resulting in a game with arcade-style, bouncy cars that are easy to control and modify.

Takeaways

  • 🚗 The game developers are creating a couch co-op game focused on being valets, emphasizing the importance of having control over the game's feel, physics, and realism in car mechanics.
  • 🛠️ They have chosen to code the car mechanics themselves to ensure they can modify and adjust the game as it evolves during development.
  • 📚 The video provides a step-by-step guide on calculating the forces required for custom car physics in Unity, using a raycast-based approach for simplicity and control.
  • 🌟 The game features an arcade-y, bouncy feel for the cars, but the techniques discussed can be adapted for simulating cars ranging from arcade to semi-realistic.
  • 🔄 The car's physics are simulated using a single rigidbody with forces applied at the location of each tire, giving the illusion of a car with tires behaving naturally.
  • 🔢 The tires are treated as having three individual forces contributing to their effect on the car: suspension (green), gas and brake (blue), and steering or slipping (red).
  • 🔄 The suspension force is calculated using a spring model with a rest distance, offset, strength, and damping to simulate the tire's interaction with the ground.
  • 🚦 The steering or slipping force is determined by calculating the current velocity in the undesired sliding direction and applying a force to counteract it, affecting the car's traction.
  • 🚀 The acceleration force is based on a lookup curve representing the car's engine power or torque, which varies with the car's speed, providing a more realistic driving experience.
  • 🏎️ The braking force is similar to the steering force, applying a force in the opposite direction of the tire's rolling to slow down or stop the car.
  • 🔧 The game's car physics can be easily tuned by adjusting values for suspension, grip, and the power curve, allowing for fine-tuning of the driving experience.

Q & A

  • What is the main focus of the video script about?

    -The video script focuses on the development of a couch co-op game where players act as valets, with an emphasis on creating custom car physics in Unity.

  • Why did the developers choose to code the game mechanics themselves?

    -The developers chose to code the game mechanics themselves to have complete control over the feel, physics, and realism of the cars in their game, allowing for modifications and adjustments as the game evolves during development.

  • What approach did the developers use for the car's physics system?

    -The developers used a raycast-based approach with a single rigidbody for the car, applying forces at the location of each tire to simulate the behavior of a car with tires.

  • How many forces are considered for each tire in the car's physics?

    -For each tire, there are three individual forces considered: suspension (green direction), gas and brake (blue direction), and steering or slipping (red direction).

  • What is the purpose of the 'spring force' in the car's suspension system?

    -The spring force in the suspension system is used to push or pull the car back to its rest distance, simulating the effect of a spring holding the car up off the ground.

  • How is the 'offset' in the spring force calculated?

    -The 'offset' is calculated as the distance from the spring's rest position, and it is a signed value indicating the direction and magnitude needed to return to the rest distance.

  • What role does 'damping' play in the car's suspension system?

    -Damping is used to slow down the motion of the spring, simulating the effect of a damper in a real car's suspension system, which resists motion and prevents excessive oscillation.

  • How is the car's traction or grip controlled in the game?

    -The car's traction or grip is controlled by calculating a force in the red direction that reduces slipping, based on the tire's current velocity in the sliding direction and a lookup curve that determines traction based on the percentage of sliding velocity.

  • What is the basis for the car's acceleration and braking forces?

    -The car's acceleration and braking forces are based on the direction the tires like to roll (blue direction). Acceleration is controlled by a lookup curve representing the car's engine power or torque, while braking is achieved by applying a force to remove velocity in the rolling direction, similar to steering.

  • How can the car's behavior be adjusted in the game?

    -The car's behavior can be adjusted by tuning various values such as the strength and damping of the spring force, the grip percentage for each tire, and the shape of the lookup curves for traction and engine power.

  • What platform is the game 'Very Very Valet' available on?

    -The game 'Very Very Valet' is available on Nintendo Switch, Steam, and PlayStation 5.

Outlines

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Mindmap

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Keywords

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Highlights

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Transcripts

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora
Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
Unity GameCar PhysicsArcade HandlingSuspension ForceRaycast MethodGame DevelopmentMechanic SimulationVehicle DynamicsCustom TuningPhysics Engine
¿Necesitas un resumen en inglés?