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

Did you know that today is #InternationalJazzDay? ๐ŸŽท๐Ÿ˜Ž

No? ๐Ÿ˜ฏ Well, we couldn't pass up this date!

And what better to celebrate this day than #Pecaminosa #OST? ๐ŸŽท

Let us know what you think about it and have a great weekend!

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

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

#sonic #mario #photoshop

๐Ÿ’Did you like the game? A demo is available for free on Steam.

โœŒ๏ธ Thanks for playing IndieGameiacs!

โš™๏ธ Free Demo: http://bit.ly/UniDuni

๐Ÿ“บ Full Video: https://youtu.be/5qEbVXg7GaQ

#steam #uniduni #clops #screenshotsaturday

Showing off player 2 ๐Ÿ˜Ž

What do you think?

Auto-chess meets Clash Royale in an intense strategic battle. Outsmart your opponent, hide your play and crush their armies! Empire Builder just got another major update, check it out! https://gamejolt.com/games/EmpireBuilder/558901

Cash Banooca

not the greatest house, but it's a house! :D

Who's is this little cutey๐Ÿ‘ธ here? Thanks๐Ÿ™ for a gorgeous fanart @WheNa! Feel free to share your arts, screenshots, or videos with #playzelter or #zelter hashtags! #pixelart #animating #unity3d #animated #indiegames #unrealengine #animate #conceptart

it happens