How To Throw anything ?

Hey everybody,
This sound very Silly but i’m working on a new game
and i cant Programming or Modelling
I need to throw a object called “Hard drive”
I just want to pick it up and Throw it
can someone give me a script please im already looking for a script for already 5 days or more.

You might want to make an inventory for the player, then upon pickup (collision probably) add the prefab to the inventory and destroy it. Then upon throwing it (probably a key press) you’ll instantiate the prefab and remove it from the inventory.
But really, making games isn’t as easy as drag-n’-drop, even with tools such as GameMaker or FPSCreator. If you want to make games you need to know game-making-related things, such as scripting (and really there’s no reason you can’t learn JavaScript at the very least).

Example script (c#):

using UnityEngine;
using System.Collections;

public class ThrowTest : MonoBehaviour
{
	public Transform Inventory;
	public float ThrowDistance = 2f;

	void OnCollisionEnter (Collision collision)
	{
		if ( collision.transform.tag == "pickup" )
		{
			Inventory = collision.transform;
			Destroy(collision.transform.gameObject);
		}
	}

	void Update()
	{
		if (Input.GetKeyDown("space"))
		{
			var thrownItem = Instantiate(Inventory, transform.position, Quaternion.identity) as Transform;
			thrownItem.name = Inventory.name;
			thrownItem.Translate(0, 0, ThrowDistance);
			Inventory = null;
		}
	}
}

I know its stupid but i can modelling just not so good
and i will learn javascript now i just need to find something in german

To make this one work you’ll have to manually add the HoldPosition game object to the player’s hierarchy and position it where you want the hands to be.

using UnityEngine;
using System.Collections;

public class ThrowTest : MonoBehaviour
{
	public Transform HoldPosition; //This is the point where the "hands" of the player would be
	public float ThrowForce = 10f; //How strong the throw is. This assumes the picked object has a rigidbody component attached
	public float AlphaAmount = 0.5f; //this will be the alpha amount. It's public so you can change it in the editor

	private Transform _pickedObject;
	private Color _originalColor;

	void OnCollisionEnter (Collision collision)
	{
		if ( collision.transform.tag == "pickup" )
		{
			//caches the picked object
			_pickedObject = collision.transform;

			//caches the picked object's color for resetting later
			_originalColor = _pickedObject.renderer.material.color;

			//this will snap the picked object to the "hands" of the player
			_pickedObject.position = HoldPosition.position;

			//this will set the HoldPosition as the parent of the pickup so it will stay there
			_pickedObject.parent = HoldPosition;

			//this will change the alpha amount on the object's color to make it half transparent
			_pickedObject.renderer.material.color = new Color(_pickedObject.renderer.material.color.r,
											_pickedObject.renderer.material.color.g,
											_pickedObject.renderer.material.color.b,
			                                AlphaAmount);
		}
	}
	
	void Update()
	{
		if (Input.GetKeyDown("space"))
		{
			if (_pickedObject != null)
			{
				//resets the pickup's parent to null so it won't keep following the player
				_pickedObject.parent = null;

				//resets the pickup's color so it won't stay half transparent forever
				_pickedObject.renderer.material.color = _originalColor;

				//applies force to the rigidbody to create a throw
				_pickedObject.rigidbody.AddRelativeForce(transform.forward * ThrowForce, ForceMode.Impulse);

				//resets the _pickedObject 
				_pickedObject = null;
			}
		}
	}
}

thanks,
i will try it later
if i come home again :smiley: