Tank tuning
This commit is contained in:
@@ -10,10 +10,9 @@ namespace Components
|
|||||||
struct Vehicle : Component
|
struct Vehicle : Component
|
||||||
{
|
{
|
||||||
Vehicle()
|
Vehicle()
|
||||||
: MaxTorque(1000.0f), MinRPM(0.0f), OptimalRPM(2000.0f), MaxRPM(3000.0f), MaxSteeringAngle(35), TopSpeed(70.0f),
|
: MaxTorque(1000.0f), MinRPM(200.0f), OptimalRPM(3000.0f), MaxRPM(6000.0f), MaxSteeringAngle(35), TopSpeed(90.0f),
|
||||||
MaxSpeedFullSteeringAngle(40.0f), SpringDamping(1.f), UpshiftRPM(2500.0f), DownshiftRPM(500.0f),
|
MaxSpeedFullSteeringAngle(40.0f), SpringDamping(1.f), UpshiftRPM(5500.0f), DownshiftRPM(1000.0f),
|
||||||
gearsRatio0(4.5f), gearsRatio1(2.5f), gearsRatio2(1.0f), gearsRatio3(0.5f){ }
|
gearsRatio0(3.0f), gearsRatio1(2.25f), gearsRatio2(1.5f), gearsRatio3(1.0f){ }
|
||||||
//gearsRatio0(3.0f), gearsRatio1(2.25f), gearsRatio2(1.5f), gearsRatio3(1.0f)
|
|
||||||
float MaxTorque;
|
float MaxTorque;
|
||||||
float MinRPM;
|
float MinRPM;
|
||||||
float OptimalRPM;
|
float OptimalRPM;
|
||||||
|
|||||||
@@ -237,6 +237,19 @@ void Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID p
|
|||||||
if(m_Vehicles.find(car) != m_Vehicles.end())
|
if(m_Vehicles.find(car) != m_Vehicles.end())
|
||||||
{
|
{
|
||||||
m_PhysicsWorld->markForWrite();
|
m_PhysicsWorld->markForWrite();
|
||||||
|
|
||||||
|
/*auto player = m_World->GetComponent<Components::Player>(car);
|
||||||
|
if(player)
|
||||||
|
{
|
||||||
|
if(player->ID == 1)
|
||||||
|
{
|
||||||
|
LOG_INFO("Speed: %f, Gear: %i, RPM: %f", m_Vehicles[car]->calcKMPH(), m_Vehicles[car]->m_currentGear, m_Vehicles[car]->m_rpm);
|
||||||
|
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_Vehicles[car]->getChassis()->activate();
|
m_Vehicles[car]->getChassis()->activate();
|
||||||
|
|
||||||
hkVector4 hardPoint = m_Vehicles[car]->m_suspension->m_wheelParams[wheelComponent->ID].m_hardpointChassisSpace;
|
hkVector4 hardPoint = m_Vehicles[car]->m_suspension->m_wheelParams[wheelComponent->ID].m_hardpointChassisSpace;
|
||||||
@@ -409,7 +422,6 @@ void Systems::PhysicsSystem::OnEntityCommit( EntityID entity )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VehicleSetup vehicleSetup;
|
VehicleSetup vehicleSetup;
|
||||||
// Create the basic vehicle.
|
// Create the basic vehicle.
|
||||||
m_Vehicles[entity] = new hkpVehicleInstance(m_RigidBodies[entity]);
|
m_Vehicles[entity] = new hkpVehicleInstance(m_RigidBodies[entity]);
|
||||||
@@ -638,6 +650,8 @@ void Systems::PhysicsSystem::OnEntityCommit( EntityID entity )
|
|||||||
std::vector<hkReal>* vertices = new std::vector<hkReal>;
|
std::vector<hkReal>* vertices = new std::vector<hkReal>;
|
||||||
std::vector<hkUint16>* vertexIndices = new std::vector<hkUint16>;
|
std::vector<hkUint16>* vertexIndices = new std::vector<hkUint16>;
|
||||||
auto meshShape = ResourceManager->Load<OBJ>("OBJ", meshShapeComponent->ResourceName);
|
auto meshShape = ResourceManager->Load<OBJ>("OBJ", meshShapeComponent->ResourceName);
|
||||||
|
if(!meshShape)
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto &vertex : meshShape->Vertices)
|
for (auto &vertex : meshShape->Vertices)
|
||||||
{
|
{
|
||||||
@@ -749,7 +763,7 @@ bool Systems::PhysicsSystem::OnTankSteer(const Events::TankSteer &event)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deviceStatus->m_positionX = steeringX;
|
deviceStatus->m_positionX = event.PositionX;
|
||||||
deviceStatus->m_positionY = event.PositionY;
|
deviceStatus->m_positionY = event.PositionY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "Components/HingeConstraint.h"
|
#include "Components/HingeConstraint.h"
|
||||||
#include "Components/WheelPair.h"
|
#include "Components/WheelPair.h"
|
||||||
#include "Components/TowerSteering.h"
|
#include "Components/TowerSteering.h"
|
||||||
|
#include "Components/Player.h"
|
||||||
#include "Events/TankSteer.h"
|
#include "Events/TankSteer.h"
|
||||||
#include "Events/SetVelocity.h"
|
#include "Events/SetVelocity.h"
|
||||||
#include "Events/ApplyForce.h"
|
#include "Events/ApplyForce.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user