Tank tuning

This commit is contained in:
ViktorLjung
2014-06-03 18:54:08 +02:00
parent a00c145616
commit 486922a7c5
3 changed files with 20 additions and 6 deletions
+3 -4
View File
@@ -10,10 +10,9 @@ namespace Components
struct Vehicle : Component
{
Vehicle()
: MaxTorque(1000.0f), MinRPM(0.0f), OptimalRPM(2000.0f), MaxRPM(3000.0f), MaxSteeringAngle(35), TopSpeed(70.0f),
MaxSpeedFullSteeringAngle(40.0f), SpringDamping(1.f), UpshiftRPM(2500.0f), DownshiftRPM(500.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)
: MaxTorque(1000.0f), MinRPM(200.0f), OptimalRPM(3000.0f), MaxRPM(6000.0f), MaxSteeringAngle(35), TopSpeed(90.0f),
MaxSpeedFullSteeringAngle(40.0f), SpringDamping(1.f), UpshiftRPM(5500.0f), DownshiftRPM(1000.0f),
gearsRatio0(3.0f), gearsRatio1(2.25f), gearsRatio2(1.5f), gearsRatio3(1.0f){ }
float MaxTorque;
float MinRPM;
float OptimalRPM;
+16 -2
View File
@@ -237,6 +237,19 @@ void Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID p
if(m_Vehicles.find(car) != m_Vehicles.end())
{
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();
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;
// Create the basic vehicle.
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<hkUint16>* vertexIndices = new std::vector<hkUint16>;
auto meshShape = ResourceManager->Load<OBJ>("OBJ", meshShapeComponent->ResourceName);
if(!meshShape)
return;
for (auto &vertex : meshShape->Vertices)
{
@@ -749,7 +763,7 @@ bool Systems::PhysicsSystem::OnTankSteer(const Events::TankSteer &event)
}
else
{
deviceStatus->m_positionX = steeringX;
deviceStatus->m_positionX = event.PositionX;
deviceStatus->m_positionY = event.PositionY;
}
+1
View File
@@ -23,6 +23,7 @@
#include "Components/HingeConstraint.h"
#include "Components/WheelPair.h"
#include "Components/TowerSteering.h"
#include "Components/Player.h"
#include "Events/TankSteer.h"
#include "Events/SetVelocity.h"
#include "Events/ApplyForce.h"