So, the closer to the player I click, the slower the object get. I suspect it’s because of something in the rotation? Also, if I am very close to the spawn, it shoots the other way…

```
if(p.x > this.transform.position.x)
{
RfireSpawn.LookAt(p);
gren = Instantiate(fireBall,RfireSpawn.transform.position,RfireSpawn.transform.rotation);
gren.transform.position.z = 100;
gren.transform.LookAt(p);
gren.rigidbody.AddForce(gren.transform.forward * 800);
lastShotTime = Time.time;
}
if(p.x < this.transform.position.x)
{
LfireSpawn.LookAt(p);
gren = Instantiate(fireBall,LfireSpawn.transform.position,LfireSpawn.transform.rotation);
gren.transform.position.z = 100;
gren.transform.LookAt(p);
gren.rigidbody.AddForce(gren.transform.forward * 800);
lastShotTime = Time.time;
}
```

Ive gone over this and about a thousand other ones, there is nothing for the ray to hit, so casting a ray doesn’t seem to do anything. This didn’t help at all. http://forum.unity3d.com/threads/screentoworldpoint-problem.27560/

the issue turned out to be in the assignment of p

```
ray = camcam.ScreenPointToRay(Input.mousePosition);
p = ray.GetPoint(132);//playplane + distance of camera from plane - nearclip of 1//
p.z = 100;//actual location of the play plane for use as a 2d lookat point
```

the distance had to be given providing the cameras distance from 0, not from the play plane(100 in this case) so it was the play plane plus camera distance from that, and it corrected the issue. It appears that the **ray was being cast at an angle**. Due it appears, to the perspective camera.

In the spawn area, here is the fully corrected code for anyone who needs it…

```
function shootFireBall(p : Vector3)
{
if(Time.time - lastShotTime > shotWait)
{
PlayerScores.score -= 1;
score = PlayerScores.score;
Scoretxt.text = "" + score;
if(p.x > this.transform.position.x)
{
activeSpawn = RfireSpawn.transform;
}else{activeSpawn = LfireSpawn.transform;}
activeSpawn.LookAt(p);///set to a 2d plane via the prior p.z = 100
gren = Instantiate(fireBall,activeSpawn.transform.position,activeSpawn.transform.rotation);
gren.rigidbody.AddForce(gren.transform.forward * 500);
lastShotTime = Time.time;
}
}
```

Velocity and aim of fireballs appear to be consistent regardless of how close the mouse is to the player object.

Hi,

Yeah - I think the speed is not getting slower at all, it just appears that way because you are clicking and comparing to the X position, but firing the fireball from z=100, so when your pos.x is close to the spawn point - it is travelling from z=100 to z=0 (visually, that’s where the force is hiding - it’s not fully present in the visual x direction).

What is the reasoning by translating the fireball into the z=100 position?

Also, the code can be made much easier:

```
Transform t;
if(p.x > this.transform.position.x)
t = RfireSpawn;
else
t = LfireSpawn;
t.LookAt(p);
gren = Instantiate(fireBall,t.transform.position,t.transform.rotation);
gren.transform.position.z = 100;
gren.transform.LookAt(p);
gren.rigidbody.AddForce(gren.transform.forward * 800);
lastShotTime = Time.time;
```