Skip to content

Commit

Permalink
#32 - Moving remainder of Raven YUKA calls to game folder
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbrzeski committed Jan 12, 2025
1 parent ad089ee commit 5327f55
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 38 deletions.
37 changes: 0 additions & 37 deletions client/src/app/scenograph/objects/aircraft/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Currently hardcoded to use the Raven aircraft.
*/
import * as THREE from 'three';
import * as YUKA from 'yuka';

/**
* Internal libs and helpers.
Expand Down Expand Up @@ -120,42 +119,6 @@ export default class Raven extends RavenBase {

l.scenograph.entityManager.add( this.actor.entity );

let obstacles = [];

// const boundaryHandler = new YUKA.ObstacleAvoidanceBehavior(
// obstacles
// )
// this.vehicle.steering.add( boundaryHandler );


const loopDistance = 1500;
const path = new YUKA.Path();
path.loop = true;
path.add( new YUKA.Vector3( loopDistance, 200, loopDistance ) );
path.add( new YUKA.Vector3( loopDistance, 200, - loopDistance ) );
path.add( new YUKA.Vector3( - loopDistance, 200, - loopDistance ) );
path.add( new YUKA.Vector3( - loopDistance, 200, loopDistance ) );

// const wanderBehavior = new YUKA.WanderBehavior();
// // wanderBehavior.distance = 100;
// // wanderBehavior.jitter = 100;
// // wanderBehavior.radius = 1.5;
// this.vehicle.steering.add( wanderBehavior );

const followPathBehavior = new YUKA.FollowPathBehavior( path );
this.actor.entity.steering.add( followPathBehavior );

// l.current_scene.objects.boundaries.forEach( ( boundaryMesh ) => {
// const obstacle1 = new YUKA.GameEntity();
// obstacle1.position.copy( boundaryMesh.position );

// obstacle1.boundingRadius = boundaryMesh.geometry.boundingSphere.radius;

// l.scenograph.entityManager.add( obstacle1 );
// obstacles.push(obstacle1);
// } );


}

// Runs on the main animation loop
Expand Down
18 changes: 17 additions & 1 deletion game/src/actors/pirate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,23 @@ export default class Pirate {
this.entity.boundingRadius = 20;
this.entity.smoother = new YUKA.Smoother( 20 );
this.entity.rotation.order = 'XYZ';


const loopDistance = 1500;
const path = new YUKA.Path();
path.loop = true;
path.add( new YUKA.Vector3( loopDistance, 200, loopDistance ) );
path.add( new YUKA.Vector3( loopDistance, 200, - loopDistance ) );
path.add( new YUKA.Vector3( - loopDistance, 200, - loopDistance ) );
path.add( new YUKA.Vector3( - loopDistance, 200, loopDistance ) );

// const wanderBehavior = new YUKA.WanderBehavior();
// // wanderBehavior.distance = 100;
// // wanderBehavior.jitter = 100;
// // wanderBehavior.radius = 1.5;
// this.vehicle.steering.add( wanderBehavior );

const followPathBehavior = new YUKA.FollowPathBehavior( path );
this.entity.steering.add( followPathBehavior );
}
}

Expand Down

0 comments on commit 5327f55

Please sign in to comment.