# Zjbcool-pathfinding

Verge3D自动寻径插件,计算3D导航网格上两点之间的最近路径,并控制角色运动。基于three-pathfinding (opens new window)

EN

The pathfinding plugin for Verge3D calculates the nearest path between two points on the 3D navigation mesh and controls the movement of the character. Based on three-pathfinding (opens new window).

示例 (opens new window)

截图

# load script

用于从CDN加载three-pathfinding.js库,还可以在.html文件中使用script标签加载。

<script src='https://cdn.jsdelivr.net/npm/three-pathfinding@0.14.1/dist/three-pathfinding.umd.js'></script>
1
EN

Load the three-pathfinding.js library from CDN. also, you use the 'script' tag in your .html file to load it.

img

# create pathfinder

该拼图用于创建Pathfinder实例。

参数:

EN

This puzzle used to create a instance of Pathfinder.

Parameters:

  • obj - Text/String, navigation mesh,you can create it using Blender2.79,see Creating a Nav Mesh (opens new window)
  • playerPosition - List/Array, The initial position of the player
  • extraOption - Dictionary/Object, Extra options for controlling player attributes

img

# set prop

在一个字典中设置玩家的属性。

EN

Sets the player's attribute in a dictionary.

img

# get player

根据导航网格获取玩家名称。

EN

Get the player's name according to the navigation mesh.

img

# teleport player

瞬间将玩家传递到指定位置。

EN

Teleport the player to the specific position immediately.

img

# calculate path

计算玩家当前位置和指定位置之间的最近路径。

EN

Calculate the nearest path between the player's current position and specific position.

img

# animate player

沿着计算出的路径将玩家移动到目标位置。

参数:

  • speed - 数字,动画的速度
  • endDistance - 数字,动画结束时,玩家和终点的距离
  • lockUp - 布尔,锁定玩家垂直方向的轴
  • obj - 字符串,导航网格名称
  • moving:do - 回调函数,当动画播放时执行该插槽下的拼图
  • stop:do - 回调函数,当动画结束时执行该插槽下的拼图
EN

Move player to target along with the path calculated.

Parameters:

  • speed - Number, the speed of the animation
  • endDistance - Number, the distance between player and target when the animation stopped
  • lockUp - Boolean, lock the player's vertical axis
  • obj - String, the navigation mesh
  • moving:do - callbacks, execute the puzzles in the slot when the animation is playing
  • stop:do - callbacks, execute the puzzles in the slot when the animation stopped

img

上次更新: 2021-6-14 11:36:18 ├F10: AM┤