Wheel Collider
Library
thumb_up
7
open_in_new
View on sbox.game
Wheel Collider
Collider for ground vehicles, with built-in collision detection, basic suspension physics, and a basic tire friction model.
Usage
Create a car GameObject with a Rigidbody component, a collider, and a model.
Create four empty child GameObjects with just models. These shouldn't have colliders or be rigidbodies.
Attach a Component script that controls the car on the car GameObject, for example:
public sealed class Car : Component
{
[RequireComponent] public Rigidbody Rigidbody { get; set; }
private List<Wheel> Wheels;
protected override void OnEnabled()
{
Wheels = Components.GetAll<Wheel>( FindMode.EverythingInSelfAndDescendants ).ToList();
}
protected override void OnFixedUpdate()
{
float verticalInput = Input.AnalogMove.x;
float torque = verticalInput * 10000f;
// Apply torque to each drive wheel
foreach ( Wheel wheel in Wheels )
{
wheel.ApplyMotorTorque( torque );
}
}
}
No usage statistics available
This package may be new or not widely used yet. Usage data becomes available as more users install and play with the package.
This package may be new or not widely used yet. Usage data becomes available as more users install and play with the package.
0 recorded entries
| Rank | Player | Score | Recorded |
|---|---|---|---|
|
refresh
Discovering package leaderboards...
|
|||
Package ID:
facepunch.libwheel
Created:
2024-07-11 15:17 UTC
Updated:
2024-08-10 13:01 UTC
Type:
library
Public:
No
Version:
65296
files:
6
Size:
0.0 MB
Engine Version:
17
Asset Version ID:
65296
Version Created:
2024-08-10 13:01 UTC
Hash:
-3350595593643487300
Manifest: Open manifest
more_horiz Additional Properties
Compiler:
{"RootNamespace":"Sandbox","DefineConstants":"SANDBOX;ADDON;DEBUG","NoWarn":"1701;1702;1591;","Nullables":true,"WarningsAsErrors":"","Whitelist":true,"AssemblyReferences":[],"IgnoreFolders":[],"DistinctAssemblyReferences":[]}
65296
Aug 10, 2024
Changes on 2024-08-10
60338
Jul 15, 2024
Changes on 2024-07-15
60335
Jul 15, 2024
Changes on 2024-07-15
60135
Jul 11, 2024
Changes on 2024-07-11
60133
Jul 11, 2024
Initial
Live API Passthrough & Removal Notice
This file manifest and asset metadata are retrieved live directly from the official Facepunch s&box public API. s&box Explorer does not host, store, or redistribute any package files. All download links route directly to Facepunch CDN servers.