Difference between revisions of "Talk:Screenshake"
From MechWarrior: Living Legends Wiki
DeimosEvotec (talk | contribs) (added dist and inFOV) |
DeimosEvotec (talk | contribs) m |
||
| Line 8: | Line 8: | ||
<code> | <code> | ||
float dist = (pClientActor->GetEntity()->GetWorldPos() - explosionInfo.pos).len(); | float dist = (pClientActor->GetEntity()->GetWorldPos() - explosionInfo.pos).len(); | ||
| + | Vec3 eyeToExplosion = explosionInfo.pos - state.eyePosition; | ||
| + | eyeToExplosion.Normalize(); | ||
bool inFOV = (state.eyeDirection.Dot(eyeToExplosion) > 0.68f); | bool inFOV = (state.eyeDirection.Dot(eyeToExplosion) > 0.68f); | ||
| + | if(pActor && pActor->GetLinkedVehicle()) | ||
| + | { | ||
| + | Vec3 eyeDir = static_cast<CPlayer*>(pActor)->GetVehicleViewDir(); | ||
| + | inFOV = (eyeDir.Dot(eyeToExplosion) > 0.68f); | ||
| + | } | ||
if(inFOV && (dist < explosionInfo.radius)) | if(inFOV && (dist < explosionInfo.radius)) | ||
{ | { | ||
Revision as of 16:57, 12 December 2020
Deimos:
just leaving this here so I don't have to search it in the code again
also doesn't that mean that screenshake doesn't scale with pressure but explosion radius?
might have to change that
float dist = (pClientActor->GetEntity()->GetWorldPos() - explosionInfo.pos).len();
Vec3 eyeToExplosion = explosionInfo.pos - state.eyePosition;
eyeToExplosion.Normalize();
bool inFOV = (state.eyeDirection.Dot(eyeToExplosion) > 0.68f);
if(pActor && pActor->GetLinkedVehicle())
{
Vec3 eyeDir = static_cast<CPlayer*>(pActor)->GetVehicleViewDir();
inFOV = (eyeDir.Dot(eyeToExplosion) > 0.68f);
}
if(inFOV && (dist < explosionInfo.radius))
{
if (explosionInfo.damage>10.0f || explosionInfo.pressure>100.0f)
{
//Add some angular impulse to the client actor depending on distance, direction...
float dt = (1.0f - dist/explosionInfo.radius);
dt = dt * dt;
float angleZ = g_PI*0.15f*dt;
float angleX = g_PI*0.15f*dt;
pActor->AddAngularImpulse(Ang3(Random(-angleX*0.5f,angleX),0.0f,Random(-angleZ,angleZ)),0.0f,dt*2.0f);
}
}