public void AttackCallback() { var arrow = EntityFactory.Instance.CreateArrow().GetComponent <Rigidbody>(); arrow.GetComponent <Arrow>().Owner = Entity; arrow.position = Spawn.position; var origin = Spawn.position; var target = Entity.Engaging.Target.Position; var yOffset = Entity.Engaging.Target.Agent.height * 0.75f; arrow.velocity = Ballistic.ComputeInitialVelocity(origin, target, yOffset); }
private Vector3 ComputeVelocity(Projectile projectile) { var origin = Spawn.position; var offset = new Vector3(Random.Range(-0.2f, 0.2f), Random.Range(0.0f, 0.45f)); // TODO for movie only !!! // offset.y = .4f; var target = projectile.Target.position + offset; var speed = projectile.speed; var gravity = projectile.UseGravity; return(Ballistic.ComputeInitialVelocity(origin, target, speed, gravity)); }