Falco Engine 3.9.0.1 (beta)
Vehicle.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Runtime.CompilerServices;
5using System.Text;
6
7namespace FalcoEngine
8{
9 public class Vehicle : Component
10 {
11 public struct Wheel
12 {
13 public float radius { get; set; }
14 public float width { get; set; }
15 public float suspensionStiffness { get; set; }
16 public float suspensionDamping { get; set; }
17 public float suspensionCompression { get; set; }
18 public float suspensionRestLength { get; set; }
19 public float friction { get; set; }
20 public float rollInfluence { get; set; }
21 public Vector3 direction { get; set; }
22 public Vector3 axle { get; set; }
23 public Vector3 connectionPoint { get; set; }
24 public bool isFrontWheel { get; set; }
25 public GameObject connectedObject { get; set; }
26 }
27
28 internal Vehicle()
29 {
30
31 }
32
36 public int numWheels { [MethodImpl(MethodImplOptions.InternalCall)] get; }
37
41 public float speedKMH { [MethodImpl(MethodImplOptions.InternalCall)] get; }
42
48 public void SetSteering(float angle, int wheelIndex)
49 {
50 INTERNAL_setSteering(angle, wheelIndex);
51 }
52
58 public float GetSteering(int wheelIndex)
59 {
60 return INTERNAL_getSteering(wheelIndex);
61 }
62
68 public void SetBreak(float value, int wheelIndex)
69 {
70 INTERNAL_setBreak(value, wheelIndex);
71 }
72
78 public void ApplyEngineForce(float value, int wheelIndex)
79 {
80 INTERNAL_applyEngineForce(value, wheelIndex);
81 }
82
83 //-------------- INTERNAL CALLS ----------------//
84
85 [MethodImpl(MethodImplOptions.InternalCall)]
86 private extern void INTERNAL_setSteering(float angle, int wheel);
87
88 [MethodImpl(MethodImplOptions.InternalCall)]
89 private extern float INTERNAL_getSteering(int wheel);
90
91 [MethodImpl(MethodImplOptions.InternalCall)]
92 private extern void INTERNAL_setBreak(float value, int wheel);
93
94 [MethodImpl(MethodImplOptions.InternalCall)]
95 private extern void INTERNAL_applyEngineForce(float value, int wheel);
96 }
97}
float GetSteering(int wheelIndex)
Get the wheel steering angle in degrees
Definition: Vehicle.cs:58
int numWheels
Gets the number of wheels attached to this vehicle
Definition: Vehicle.cs:36
void SetBreak(float value, int wheelIndex)
Set wheel's braking ratio
Definition: Vehicle.cs:68
void SetSteering(float angle, int wheelIndex)
Set the wheel steering angle in degrees
Definition: Vehicle.cs:48
float speedKMH
Gets the current vehicle speed in kilometers per hour
Definition: Vehicle.cs:41
void ApplyEngineForce(float value, int wheelIndex)
Apply engine force to the wheel
Definition: Vehicle.cs:78
GameObject connectedObject
Definition: Vehicle.cs:25