Making laser beam point in shooting direction C#

Ok, so basicly I’m making a 3d space shooter game, and I wan’t to be able to shoot a laser. I have a projectile script, which I have attatched to a prefab that gets instantiated whenever I press the spacebar. My Projectile is in this case just a stretched colored capsule. The problem is, that my laser isn’t laying down and pointing in the direction I’m shooting, its basicly standing up instead of laying down pointing towards it’s target. So basicly I want this __ instead of this |. Hope it’s clear what I mean.

Here is the projectile script:

	void Update () 
	{
		float amountToMove = ProjectileSpeed * Time.deltaTime;
		transform.Translate(Vector3.forward * amountToMove);
		Destroy(gameObject, 5);
	
	}

And here I’m shooting my laser inside my player script:

        if(Input.GetKeyDown("space"))
    		{
    			Instantiate(ProjectilePrefab, transform.position, transform.rotation);
    		}

I have also tried with Quaternion.identity as rotation, but doesn’t make a diffrence.
even if I change the standard facting direction of the beam before it get instantiated.

Hope someone can help with this
Thanks in advance

It sounds to me like a problem with how you are defining where it points.

The good old Tornado Twins Worm game would give you some really good tips on how to do all of that. Probably a bit of overkill for what you want. If every new person would take the time to watch the video set we would probably see alot less easy questions. :slight_smile: Yours is not necessarily easy, but would take alot of typing and back and forth to pin down.

http://www.unityprefabs.com/wormgame-cartoony-series-tutorial.html

Nice, that set looks very helpful. Thank you :slight_smile: