- Home /
This question was
closed Dec 17, 2014 at 09:54 PM by
Graham-Dunnett for the following reason:
Duplicate Question
Question by
metobayrak · Dec 17, 2014 at 09:54 PM ·
raycastbce0023
Assets/RayShoot.js(35,19): BCE0023: No appropriate version of 'UnityEngine.Physics.Raycast' for the argument list '(UnityEngine.Vector3, UnityEngine.Vector3, System.Type, float)' was found.
var Menzil : float = 1000;
var Kuvvet : float = 1000;
var Sarjor : int = 90;
var SarjorMermi : int = 30;
var YenilemeZamani : float = 2;
var KalanMermi : int = 0;
var AtesZamani : float = 0;
var AtesSiralama : float = 0.1;
function Start () {
KalanMermi = SarjorMermi;
Screen.showCursor = false;
Screen.lockCursor = true;
}
function update () {
if(AtesZamani > 0) {
AtesZamani -= Time.deltaTime;
}
if(AtesZamani < 0) {
AtesZamani = 0;
}
if(Input.GetMouseButton(0) && KalanMermi) {
if(AtesZamani ==0) {
RayShoot();
AtesZamani = AtesSiralama;
}
}
}
function RayShoot () {
var Vur = RaycastHit;
var DirectionRay = transform.TransformDirection(Vector3.forward);
Debug.DrawRay(transform.position, DirectionRay * Menzil , Color.red);
if(Physics.Raycast(transform.position, DirectionRay, Vur, Menzil)) {
if(Vur.rigidbody) {
Vur.rigidbody.AddForceAtPosition(DirectionRay * Kuvvet, Vur.point);
}
}
KalanMermi --;
if(KalanMermi < 0) {
KalanMermi = 0;
}
if(KalanMermi == 0) {
Yenile();
}
}
function Yenile () {
yield WaitForSeconds(YenilemeZamani);
}
Comment
Follow this Question
Related Questions
Raycasting with LayerMask gives me a bce0023 1 Answer
Getting material index from raycast 2 Answers
Raycast and Layer Masks 1 Answer
falling off 90 degree angles when walking on walls 0 Answers