NodeMover: Difference between revisions

From Crumbled World Wiki
(Created page with "{{:NodeMoverExampleCode}} ==Constructor== {| class="wikitable" !|function !|description |- |NodeMover(SceneNode nodeToMove, float walkSize, float walkSpeed, float pathOffset) |pathOffset accept a value bettwen [-1,1]. |- |} ==Functions== {| class="wikitable" !|return !|function !|description |- |bool |isAtFinalDestination() |Returns true if the node has reach the final destination. |- |Vec3 |NodeMover:getFuturePosition(fl...")
(No difference)

Revision as of 13:00, 5 July 2025

NodeMoverExampleCode

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
float getDistanceToExit() Return distance to exit.
Table getPathPoints() 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.