12 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

Short intro of us ๐Ÿ’•โœŒ๏ธ

We're an eletro duo based in Seoul ๐Ÿ‡ฐ๐Ÿ‡ท Heavily influenced by the 90s.

Our new album #Xennials is all about the nostalgia of that era ๐Ÿ’ฝ CD listenin ๐Ÿ“Ÿ beeper beepin ๐Ÿ’พ floppy disks floppin days ๐Ÿ˜Ž

Stream now! ๐ŸŽง

https://open.spotify.com/album/3YwWhnHWVy5cA8XOpbaGRA?si=8E9awqUโ€ฆ

We are under attack!

Been working lately on lots of 'behind-the-scenes' boring stuff that no one really cares about, so hereโ€™s a guy playing the sax for some reason.

#screenshotsaturday

Shoobies leave a sticky trail of mucus in their wake, which can impede movement for any creature that steps in it.

Shadow The Hedgehog X pixel art

One of the most critical update for Sunblaze demo. Now you are able to pet a cat! Finally!

Update 2.627

New challenges & new effects!

OK, this starts to be too tricky puzzle already :D

#platformer #indiegame #puzzle

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

A 1h30 painting, coffee break.

My twitter: https://twitter.com/loupil100