how to shoot a rope

I attach the Cannon.cs to the cannon to fire the rope(Link joint) with mouse aim.But When I shoot the rope,the rope is invisible,and the speed is not fast,why?

public void Fire(Vector3 pos)
	{
		//point to target
		Vector3 fireDir = pos -transform.position;
		float angle = Mathf.Atan2(fireDir.y,fireDir.x)*Mathf.Rad2Deg;
		transform.rotation = Quaternion.Euler(new Vector3(0,0,angle));	
		//spawn the rope
		GameObject bullet = Instantiate(bullets[currentLevel-1],new Vector3(transform.position.x,transform.position.y,0),Quaternion.identity) as GameObject;		
		bullet.transform.rotation = transform.rotation;
		Bullet bul = bullet.GetComponent();
		bul.moveDir = new Vector3(fireDir.x,fireDir.y,0);
		bul.level = currentLevel;

	}

If you don't format your code, you usually don't get answers. Select your code and use the 101/010 button. I've formatted it for you this time.

Thank you for telling me that ,I will take care of it,the first time ever to show my question here, I will try to learn it

You can put in screenshots to help other understand what you have and you might get answers faster.

what do you mean when you say current level?

1 Answer

1

Hi guys

I am also interested in the processed of attaching ropes between two shots; I have ideas and seen tutorials for firing a bullet and objects but have no idea how to attach the rope between them and unsure how to give the rope physics as well.

Can anyone give an indication using pseudo code?