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

Just as Pecaminosa's musicians #improvise this rendition of #LittleSunflower 🌻, so do we improvise with this post you're reading. πŸ˜‚

What's coming out of your own improvs? πŸ€”

#Pecaminosa | #IndieDev | #OST | #Jazz

"Thanks guys for endless hours of fun." πŸ‘

(My first fan art. Read the article, please.)

#sonic #mario #photoshop

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

Updated the chest in the maze, adding sound, particles and better animation. But what's in the chest?

So here's the first of the zodiac signs i will make for the next weeks.

I worked so hard to get all four of them to the end safely, but then...

Cash Banooca

Path of Kami, running around the shrine area

Animation test. Not an actaul conclusion to who wins sonic vs Mario. Just a test animation combo.

Colorful Fox

Happy Late Easter!