update(boatobj, time)
	{
		if (this.enemyobj && boatobj)
		{
			this.enemyobj.lookAt(boatobj.position);
			if (activated)
			{
				const direction = new THREE.Vector3();
				this.enemyobj.children[0].getWorldDirection(direction);
				this.enemyobj.position.add(direction.multiplyScalar(this.spatial.velocity));
			}
			this.enemyobj.position.y = 0.5 * Math.sin(2 * time) + 2;
				
		}
	}
// updating speed and velocity of the enemy based on received inputs
updating speed and velocity of the enemy based on received inputs
updating speed and velocity of the enemy based on received inputs
update(boatobj, time)
	{
		if (this.enemyobj && boatobj)
		{
			this.enemyobj.lookAt(boatobj.position);
			if (activated)
			{
				const direction = new THREE.Vector3();
				this.enemyobj.children[0].getWorldDirection(direction);
				this.enemyobj.position.add(direction.multiplyScalar(this.spatial.velocity));
			}
			this.enemyobj.position.y = 0.5 * Math.sin(2 * time) + 2;
		}
	}
update ( boatobj , time ) { if ( this . enemyobj && boatobj ) { this . enemyobj . lookAt ( boatobj . position ) ; if ( activated ) { const direction = new THREE . Vector3 ( ) ; this . enemyobj . children [ 0 ] . getWorldDirection ( direction ) ; this . enemyobj . position . add ( direction . multiplyScalar ( this . spatial . velocity ) ) ; } this . enemyobj . position . y = 0.5 * Math . sin ( 2 * time ) + 2 ; } }
updating speed and velocity of the enemy based on received inputs
updating speed and velocity of the enemy based on received inputs