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;
}
}
↧