Vehicles
Kontakty kol
Vrací snapshot kola s transformací, stavem odpružení a aktuálním nativním kontaktem s povrchem.
Když je kolo ve vzduchu, contact je undefined. Platný kontakt obsahuje bezpečný veřejný handle tělesa, volitelný managed wrapper, world position a normal.
Syntaxe#
var wheel = vehicle.get_wheel(index);Snapshot kola#
| Pole | Typ / jednotky |
|---|---|
| index | Index od nuly. |
| position | World-space {x,y,z}. |
| rotation | Autoritativní quaternion {x,y,z,w}. |
| rotation_euler | GameMaker helper ve stupních. |
| transform | {position, rotation}. |
| steering_angle | Stupně. |
| suspension_length | World units. |
| suspension_compression | Normalizované 0..1. |
| angular_velocity | Radiány za sekundu. |
| rotation_angle | Stupně. |
| radius / width | Nakonfigurované world units. |
| driven | Boolean driven flag. |
| has_contact | Boolean. |
| contact | Struct nebo undefined. |
Contact struct#
| Pole | Význam |
|---|---|
| body_handle | Bezpečný veřejný JoltBody handle nebo 0. |
| body | Managed JoltBody wrapper nalezený z handlu nebo undefined. |
| position | World-space kontaktní bod. |
| normal | World-space normála povrchu. |
var wheel = car.get_wheel(0);
if (!is_undefined(wheel) && wheel.has_contact) {
draw_text(16, 16, "ground body=" + string(wheel.contact.body_handle));
}Ověřené kontrakty operací#
Následující kontrakty rozlišují jednotky, návratové hodnoty, chyby a životnost podle aktuální implementace. Nevynechávej kontrolu výsledku: false, 0 a undefined mohou mít u různých metod odlišný význam.
| Symbol / vlastník | Signatura | Kontrakt operace |
|---|---|---|
| JoltVehicle.get_wheel | JoltVehicle.get_wheel(index) | Index od 0; build nutný. Vrací snapshot position/rotation/rotation_euler/transform ve světě, has_contact, contact (body_handle/position/normal a případně body), steering_angle, suspension_length/compression, angular_velocity, rotation_angle, radius, width, driven. Neplatný index/wrapper undefined. Steering/rotation_angle jsou stupně, angular_velocity rad/s; délky m. Kolo není samostatné těleso. |