Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
VehicleInternal.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "entity/EntityId.hpp"
4#include <Jolt/Physics/Body/BodyID.h>
5#include <Jolt/Physics/Vehicle/VehicleCollisionTester.h>
6#include <Jolt/Physics/Vehicle/VehicleConstraint.h>
7#include <Jolt/Physics/Vehicle/WheeledVehicleController.h>
8#include <array>
9#include <memory>
10
11namespace Physics::Component {
12
24 JPH::Ref<JPH::VehicleConstraint> vehicleConstraint;
25
28 JPH::Ref<JPH::VehicleCollisionTester> collisionTester;
29
31 std::array<Engine::EntityId, 4> wheelEntities;
32
34 std::array<JPH::BodyID, 4> wheelBodyIDs;
35
37 JPH::BodyID chassisBodyID;
38
42 bool IsValid() const { return vehicleConstraint != nullptr && !chassisBodyID.IsInvalid(); }
43
47 VehicleInternal() = default;
48
52 explicit VehicleInternal(JPH::BodyID chassis) : chassisBodyID(chassis) {}
53};
54
55} // namespace Physics::Component
Definition BoxCollider.hpp:27
JPH::Ref< JPH::VehicleCollisionTester > collisionTester
Definition VehicleInternal.hpp:28
std::array< Engine::EntityId, 4 > wheelEntities
Entity IDs of the 4 wheel entities (for transform sync).
Definition VehicleInternal.hpp:31
VehicleInternal(JPH::BodyID chassis)
Construct with chassis body ID.
Definition VehicleInternal.hpp:52
JPH::BodyID chassisBodyID
BodyID of the chassis.
Definition VehicleInternal.hpp:37
JPH::Ref< JPH::VehicleConstraint > vehicleConstraint
Definition VehicleInternal.hpp:24
bool IsValid() const
Check if the vehicle constraint is valid.
Definition VehicleInternal.hpp:42
std::array< JPH::BodyID, 4 > wheelBodyIDs
Jolt BodyIDs for the 4 wheel collision bodies.
Definition VehicleInternal.hpp:34
VehicleInternal()=default
Default constructor.