NodeMover
From Crumbled World Wiki
Constructor
| function | description |
|---|---|
| NodeMover(SceneNode nodeToMove, float walkSize, float walkSpeed, float pathOffset) | pathOffset accept a value bettwen [-1,1]. |
Functions
| return | function | description |
|---|---|---|
| bool | isAtFinalDestination() | Returns true if the node has reach the final destination. |
| Vec3 | getFuturePosition(float time) | Get the future position of the node, after a set time. (This only works if the entire path is known, special case is the mine cart which this may not be true for.) |
| Vec3 | getCurrentPosition() | Return the current global position. |
| Vec3 | getCurrentVelocity() | Return the current velocity. |
| float | getCurrentSpeed() | Return the walk speed. |
| Vec3 | getTargetGlobalPosition() | Return the next Path points global position |
| Vec3 | getPositionFromFrame(number frameId) | get a position from a frame, we only store position for 5 frames |
| float | getDistanceToExit() | Return distance to exit. |
| Table | getPathPoints(float ignorePointsWithinDistance) | Return main pathPoints. return in format {{navMeshPos = Vec2(), localIslandPos = Vec3(), islandId = number()},...} |
| Table | setPathPoints(Table pathPoints) | Set main pathPoints same format as given by getPathPoints(). |
| setWalkSpeed(float walkSpeed) | Set walk speed | |
| setMaxWalkSpeed(float maxWalkSpeed) | Caps the speed that the npc can walk. speed = min(walkSpeed,maxWalkSpeed) | |
| setWalkSize(float size) | Set the size of the npc | |
| addCallbackWayPointReached(string functionName) | Function name | |
| addMoveTo(SceneNode island, Vec3 localPosition) | ||
| followNode(SceneNode node) | ||
| update() | Update the nodeMover and move the node towards the final position. |