Fadesystem, entities, weapon muzzles should now look good. reload for secondary

This commit is contained in:
Tleety
2016-03-13 16:15:06 +01:00
parent 0963f61976
commit 9f752ad3e9
14 changed files with 1300 additions and 141 deletions
@@ -189,18 +189,29 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
return;
}
// Tracer
EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzle");
//Tracer
EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleRay");
if (tracerSpawner.Valid()) {
glm::vec3 origin = Transform::AbsolutePosition(tracerSpawner);
glm::vec3 direction = Transform::AbsoluteOrientation(tracerSpawner) * glm::vec3(0, 0, -1);
float distance = traceRayDistance(origin, direction);
EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner);
EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner, tracerSpawner);
if (ray.Valid()) {
((glm::vec3&)ray["Transform"]["Scale"]).z = distance;
}
}
//Flash
EntityWrapper flashSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleFlash");
if (flashSpawner.Valid()) {
std::uniform_real_distribution<float> randomSpreadAngle(0.f, 3.1415f*2);
EntityWrapper flash = SpawnerSystem::Spawn(flashSpawner, flashSpawner);
if(flash.Valid()){
((glm::vec3&)flash["Transform"]["Orientation"]).z = randomSpreadAngle(m_RandomEngine);
}
}
// Deal damage
if (dealDamage(cWeapon, wi)) {
// Show hit marker