Skip to content

Instantly share code, notes, and snippets.

@IshidaGames
Created December 23, 2019 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IshidaGames/032fdd1e0d3f6e6f949edf697757e931 to your computer and use it in GitHub Desktop.
Save IshidaGames/032fdd1e0d3f6e6f949edf697757e931 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShotPresent : MonoBehaviour
{
public GameObject present;
public GameObject shotPos;
Rigidbody rb;
void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
GameObject copy = Instantiate(present, shotPos.transform.position,
Quaternion.identity);
rb = copy.GetComponent<Rigidbody>();
rb.AddForce(transform.up * 500);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment