Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

hello im new to programming and i was coding a gun script then this error appeared:

$
0
0
CS1503 Cannot convert from 'UnityEngine.Vector3' to 'UnityEngine.Quaternion' the error was in line 22,49 here is my code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class shootDemo : MonoBehaviour{ // variaveis public Rigidbody projectile; public float speed = 20; public GameObject bullet; public GameObject bulletHole; public float delayTime = 0.5f; public float enemyDamage = 25f; private float counter = 0f; // Start is called before the first frame update void FixedUpdate () { if(Input.GetKey(KeyCode.Mouse0) && counter > delayTime) { Instantiate(bullet, transform.position, transform.forward); GetComponent().Play(); counter = 0; RaycastHit hit; Ray ray = new Ray(transform.position, transform.forward); if (Physics.Raycast(ray, out hit, 100f)) { if(hit.transform.tag == "theEnemy") { hit.transform.GetComponent().RemoveHealth(enemyDamage); } else { Instantiate(bulletHole, hit.point, Quaternion.FromToRotation(Vector3.up,hit.normal)); } } } counter += Time.deltaTime; } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>