logang
February 10, 2013, 4:32am
1
i have been making a game and it says collider not found and i dont know why. i tried UnityEngine.collider but other errors started showing up plz help i am a little bit new to java i only know a little bit but i cant find out what im doing wrong Plz help
Assets/Tower.js(53,40): BCE0018: The name ‘collider’ does not denote a valid type (‘not found’). Did you mean ‘UnityEngine.Collider’?
Case Matters! collider is not the same as Collider.
Also, Java is a programming language that is NOT used with Unity. You’re writing a variant of javascript . They are unfortunately named.
logang
February 10, 2013, 5:19pm
2
Here
#pragma strict
var myProjectile : GameObject;
var reLoadTime : float = 1f;
var turnSpeed : float = 5f;
var fireSpeed : float = .25f;
var muzzleEffect : GameObject;
var errorAmount ; float = .001f;
var myTarget : Transform;
var muzzlepositon : Transform[];
var turretBall : Transform;
private var nextFireTime : float;
private var nextMoveTime : float;
private var DesiredRotation : Quaternion;
private var aimError : float;
function start() {
}
function Update() {
if(myTarget) {
if(Time.deltaTime >= nextMoveTime) {
CalculateAimPositon(myTarget.position);
turretBall.rotation = Quaternion.Lerp(turretBall.rotation, desiredRotation, Time.deltatime*TurnSpeed);
}
if(Time.time>= nextFireTime) {
FireProjectile();
}
}
}
function OnTriggerEnter(other : collider) {
if(other.GameObject.tag == "Enemy"){
nextFireTime = Time.time+(reloadTime*.5);
myTarget = other.GameObject.transform;
}
}
function OnTriggerExit(other : collider) {
if(other.GameObject.tag == myTarget){
myTarget = null;
}
}
function CalculateAimPosition(targetpos : Vector3) {
var aimPoint = Vector3(targetpos.x+aimError, targetpos.y+aimError, targetpos.z+aimError);
desiredRotation = Quaternion.LookRoration(aimPoint);
}
function CalculateAimError() {
aimError = random.range[-errorAmount, errorAmount];
}
function FireProjectile() {
audio.Play();
nextFireTime = Time.deltaTime+reloadTime;
nextMoveTime = Time.deltaTime+firePauseTime;
CalculateAimError();
for(theMuzzlePos in muzzlePosition) {
Instantiate(myProjectile, theMuzzlePos.position, theMuzzlePos.rotation);
Instantiate(muzzleEffect, theMuzzlePos.position, theMuzzlePos.rotation);
}
}