I am getting the error message:
Assets/Code/Player Code/SwordAttack.cs(29,17): error CS0266: Cannot implicitly convert type double' to
float’. An explicit conversion exists (are you missing a cast?)
Assets/Code/Player Code/SwordAttack.cs(30,17): error CS0266: Cannot implicitly convert type double' to
float’. An explicit conversion exists (are you missing a cast?)
Assets/Code/Player Code/SwordAttack.cs(31,17): error CS0266: Cannot implicitly convert type double' to
float’. An explicit conversion exists (are you missing a cast?)
I am not trying to convert anything to double anywhere in my code. I cannot see where it it trying to convert the variable. Any help is greatly appreciated.
using UnityEngine;
using System;
[AddComponentMenu("Player/Sword Attack")]
class SwordAttack : MonoBehaviour{
//finds camera angle x and y for process
float basecordinantx;
float basecordinanty1;
float basecordinanty;
float basecordinantz;
//gets mouse cordinants in aray
int[] sworddirection;
//processed mouse cordinants
int[] swordpath;
//counts the number in the array
int arraynum;
//particles
public ParticleSystem SwordLine;
void Update()
{
//if left mouse is clicked
if (Input.GetMouseButton (0))return;
float camx = Camera.main.transform.eulerAngles.x;
float camy = Camera.main.transform.eulerAngles.y;
basecordinantx = Math.Sin (camy);
basecordinantz = Math.Sin (camx);
basecordinanty1 = Math.Cos (camx) + Math.Cos (camy);
basecordinanty = basecordinanty1 / 2;
Debug.Log (basecordinantx);
Debug.Log (basecordinanty);
Debug.Log (basecordinantz);
}