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

Fan art for Foolish I'm feeling kinda better so I drew this

Heya there! I really wanted to show you all a little gameplay preview of the first boss fight i'm currently working on i hope you like it ^^

Shadow The Hedgehog X pixel art

A Shiny Mega Gengar 🌟 For @ManutkArt 's #ThreeColorsChallenge!

Regular exercise is key for healthy wings.

Try it out!

https://gamejolt.com/games/AeonNightmares/605184

It's now possible to destroy some of the obstacles and gain access to new locations or create shortcuts. #gamedev #indiegame #rpg

Aston Martin Vantage 2019

Day 4, Achieved

#AstonMartin #FastChallenge #speedmodeling

A little modern base i made