Ajout de Jolt Physics + 1ere version des factory entitecomposants - camera, transform, rigidbody, collider, renderer

This commit is contained in:
Tom Ray
2026-03-22 00:28:03 +01:00
parent 6695d46bcd
commit 48348936a8
1147 changed files with 214331 additions and 353 deletions

View File

@@ -0,0 +1,54 @@
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
// SPDX-FileCopyrightText: 2023 Jorrit Rouwe
// SPDX-License-Identifier: MIT
#pragma once
#include <Tests/Vehicle/VehicleTest.h>
#include <Jolt/Physics/Vehicle/VehicleConstraint.h>
class MotorcycleTest : public VehicleTest
{
public:
JPH_DECLARE_RTTI_VIRTUAL(JPH_NO_EXPORT, MotorcycleTest)
// Description of the test
virtual const char * GetDescription() const override
{
return "This test shows how a motorcycle could be made with the vehicle constraint.\n"
"Use the arrow keys to drive. Z for hand brake.";
}
// Destructor
virtual ~MotorcycleTest() override;
// See: Test
virtual void Initialize() override;
virtual void ProcessInput(const ProcessInputParams &inParams) override;
virtual void PrePhysicsUpdate(const PreUpdateParams &inParams) override;
virtual void SaveInputState(StateRecorder &inStream) const override;
virtual void RestoreInputState(StateRecorder &inStream) override;
virtual void GetInitialCamera(CameraState &ioState) const override;
virtual RMat44 GetCameraPivot(float inCameraHeading, float inCameraPitch) const override { return mCameraPivot; }
virtual void CreateSettingsMenu(DebugUI *inUI, UIElement *inSubMenu) override;
private:
void UpdateCameraPivot();
static inline bool sOverrideFrontSuspensionForcePoint = false; ///< If true, the front suspension force point is overridden
static inline bool sOverrideRearSuspensionForcePoint = false; ///< If true, the rear suspension force point is overridden
static inline bool sEnableLeanController = true; ///< If true, the lean controller is enabled
static inline bool sOverrideGravity = false; ///< If true, gravity is overridden to always oppose the ground normal
Body * mMotorcycleBody; ///< The vehicle
Ref<VehicleConstraint> mVehicleConstraint; ///< The vehicle constraint
RMat44 mCameraPivot = RMat44::sIdentity(); ///< The camera pivot, recorded before the physics update to align with the drawn world
// Player input
float mForward = 0.0f;
float mPreviousForward = 1.0f; ///< Keeps track of last motorcycle direction so we know when to brake and when to accelerate
float mRight = 0.0f; ///< Keeps track of the current steering angle
float mBrake = 0.0f;
};