Question by
Merljn · Apr 05, 2017 at 09:39 PM ·
vrdirectionprojectile
How to make the projectile move -45
i Keep on figure it out how to make the projectile move not front direction insted ; -45 so it will move direction down
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Shooter : MonoBehaviour {
public Transform crosshair;
public GameObject projectille;
private SteamVR_TrackedController controller;
// Use this for initialization
void Start () {
controller = GetComponent<SteamVR_TrackedController>();
controller.TriggerClicked += Shoot;
}
void Shoot(object sender, ClickedEventArgs e) {
if (projectille) {
GameObject newProjectille = Instantiate (projectille, crosshair.gameObject.transform.position, transform.rotation)as GameObject;
newProjectille.GetComponent<Rigidbody>().AddForce(transform.forward * 20f, ForceMode.VelocityChange);
}
}
}
Thanks 4 the Help
Comment