/// <summary> /// Returns the origin to spawn the projectile in the attacker local space /// </summary> public Vector3 GetProjectileSpawnOrigin(uint projectileWcid, MotionCommand motion) { var attackerRadius = PhysicsObj.GetPhysicsRadius(); var projectileRadius = GetProjectileRadius(projectileWcid); //Console.WriteLine($"{Name} radius: {attackerRadius}"); //Console.WriteLine($"Projectile {projectileWcid} radius: {projectileRadius}"); var radsum = attackerRadius * 2.0f + projectileRadius * 2.0f + PhysicsGlobals.EPSILON; var origin = new Vector3(0, radsum, 0); // rotate by aim angle var angle = motion.GetAimAngle().ToRadians(); var zRotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, angle); origin = Vector3.Transform(origin, zRotation); origin.Z += Height * ProjSpawnHeight; return(origin); }