#Movement Stuff (Unsure if this is right channel)

1 messages · Page 1 of 1 (latest)

slate sand
#

Mainly based in command but I'm trying to branch into some other things. Basically, I've seen a lot of addons with a grapple hook type deal - pulling a player or an entity to a destination without using the teleport command. How can I make that happen? And, could I be able to control the speed of it?

floral idol
#

So, that isn't really as much of a molang thing AFAIK. The methods I know of are using a ridden entity with a set velocity, or applying knockback with scripts

blissful veldt
#
function moveToPoint(entity, destination, startLoc) {
    const posDiff = {
        x: destination.x - startLoc.x,
        y: destination.y - startLoc.y,
        z: destination.z - startLoc.z
    };

    if (entity.typeId === "minecraft:player") {
    entity.applyKnockback(posDiff.x, posDiff.z, Math.sqrt(posDiff ** 2 + posDiff.z ** 2), posDiff.y);
} else {
    entity.applyImpulse(posDiff)
}```
#

thats an example

#

obviously this isnt a smooth movement its just an example

slate sand
blissful veldt
#

scripting is javascript and you can do almost everything, its just 100x times better

#

I highly recommend to you to learn scripting

slate sand
#

alright

#

thanks