13 years ago

Artificial Intelligence JavaScript Unity 3D


Advanced artificial intelligence in javaScript

#pragma strict

var alvo : GameObject;

var pos : Vector3;

var dist : float;

function Start () {

alvo = GameObject.Find (“Player”);

dist = 6;

}

function Update () {

pos = alvo.transform.position;

if(alvo && Distancia ()){

var alvoRotacao = Quaternion.LookRotation (pos - transform.position , Vector3.up);

transform.rotation = Quaternion.Slerp (transform.rotation , alvoRotacao , Time.deltaTime * 3);

}

}

function Distancia (){

if(Vector3.Distance (transform.position , pos) > dist){

return false;

}

else{

return true;

}

}



0 comments

Loading...

Next up

Chiaki Nanami!

Here's a peaceful little forest scene for this #screenshotsaturday, from the beginning of the game.

What you all think

The whole squad is here!

Interested? Follow me!

An infected room from the second part of Cybel ! Are you up for some cleansing?

brung back my old oc plus a new one

...they don`t have names yet tho

Cash Banooca

I mostly build 3D First Person Shooter game mechanics in Unity, and in this I'm just showing C4 mechanics I made for a little side project I am working on! :)

Out of boredom and curiosity, I coded Sailor Jupiter's Argentine Backbreaker.