New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

three-pathfinding

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-pathfinding

Navigation mesh toolkit for three.js, based on PatrolJS

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10K
decreased by-8.49%
Maintainers
1
Weekly downloads
 
Created
Source

three-pathfinding

Navigation mesh toolkit for ThreeJS, based on PatrolJS.

Installation

npm install --save three-pathfinding

Example

  // Create level.
  const ZONE = 'level1';
  const zone = Path.buildNodes(this.navMesh.geometry);
  Path.setZoneData(ZONE, zone);

  // Find path from A to B.
  const group = Path.getGroup(ZONE, a);
  const path = Path.findPath(a, b, ZONE, group);

API

Table of Contents

buildNodes

Builds a zone/node set from navigation mesh.

Parameters

  • geometry THREE.Geometry

Returns Path.Zone

setZoneData

Sets data for the given zone.

Parameters

getGroup

Returns closest node group for given position.

Parameters

  • zoneID string
  • position THREE.Vector3

Returns Path.Group

getRandomNode

Returns a random node within a given range of a given position.

Parameters

  • zoneID string
  • group Path.Group
  • nearPosition THREE.Vector3
  • nearRange number

Returns Path.Node

getClosestNode

Returns the closest node to the target position.

Parameters

  • position THREE.Vector3
  • zoneID string
  • group Path.Group
  • checkPolygon boolean (optional, default false)

Returns Path.Node

clampStep

Clamps a step along the navmesh, given start and desired endpoint. May be used to constrain first-person / WASD controls.

Parameters

  • start THREE.Vector3
  • end THREE.Vector3 Desired endpoint.
  • node Path.Node
  • zoneID string
  • group Path.Group
  • endTarget THREE.Vector3 Updated endpoint.

Returns Path.Node Updated node.

findPath

Returns a path between given start and end points.

Parameters

  • startPosition THREE.Vector3
  • targetPosition THREE.Vector3
  • zoneID string
  • group Path.Group

Returns Array<THREE.Vector3>

Thanks to

Keywords

FAQs

Package last updated on 25 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc