[A9] Charge Lance too fast?

Started by NoImageAvailable, February 23, 2015, 02:43:32 AM

Previous topic - Next topic

NoImageAvailable

This is kind of a minor thing but I thought I'd report it anyway. While going through the game files I noticed that Verse.Projectile uses the following:

protected int StartingTicksToImpact
{
get
{
int num = Mathf.RoundToInt((this.origin - this.destination).magnitude / (this.def.projectile.speed / 100f));
if (num < 1)
{
num = 1;
}
return num;
}
}


Now I'm not well versed in Unity but from what I understand "Mathf.RoundToInt((this.origin - this.destination).magnitude" essentially corresponds to target distance in game cells which would make "this.def.projectile.speed / 100f" equivalent to cells traveled per tick. This in turn means that any projectile with a speed >100 would travel fast enough to essentially "skip" a cell without ticking. From a quick look through the files I noticed that the Charge Lance has a projectile speed of 120, i.e. it travels 1.2 cells per tick. Now seeing as tick handles the collision detection for projectiles with "canFreeIntercept=true" it would mean the Charge Lance can effectively skip over cells without performing the proper collision detection and therefore phase through pawns and in fringe cases, solid walls.
"The power of friendship destroyed the jellyfish."

Tynan

https://ludeon.com/mantis/view.php?id=812

Actually any projectile can phase like this; if the shot passes over the corner of a wall, for example, it could only need to go half a cell-width or even less of the wall cell. So it could skip over the corner bit.
Tynan Sylvester - @TynanSylvester - Tynan's Blog