I’ve been trying to fire an arrow on a 2d space.
The arrow is made of 2 cubes with rigidbodies and connected with a Fixed joint, and the whole arrow (the prefab) has a rigidbody aswell and all of them have the z axis position frozen.
Here is the issue, the arrow is being instantiated on the right place but it has no force into it, it just drop towards the ground and only after it touches the floor it starts warping at a regular distance towards the direction it was supposed to be shot at.
Here is the code in C#
public void fire()
{
Rigidbody project = Instantiate (Projectile, new Vector3(transform.position.x+1,transform.position.y,transform.position.z), Quaternion.identity) as Rigidbody;
project.AddForce (Vector2.right*shotPower);
}
Edit: If i unlock the z axis constraint and addforce towards it, the arrow works as expected, but i need it to be shot towards the x axis.
Thanks in advance