#Help with Telekenesis

1 messages · Page 1 of 1 (latest)

tawny anchor
#

I'm trying to make an ability on my server that allows me to pick up and drag an entity through the sky.
However, I cannot find a smooth way of moving an entity towards (location 5 in front of head of player).
The methods I'm using are giving drawbacks.

#

As you can see, the pig floats upwards to it's destination location, but at one point it crosses it and keeps going. I'd like to try and make the pig float up, and stop near the destination without it drifting further.

analog karma
tawny anchor
#
    set {_v} to vector from {_e} to {_loc}
    set {_v2} to vector from {_loc} to {_e}
    set vector length of {_v} to (distance between location at {_e} and {_loc}) / 10
    set vector length of {_v2} to (distance between location at {_e} and {_loc}) / 11
    push {_e} {_v}
    push {_e} {_v2}
#

Runs every tick.

#

[!] the entity has the {noGravity:1b} NBT tag enabled.

analog karma
#

I assume you are doing it in a function, please post all the code to understand it better.

#

Not just that piece

tawny anchor
#
function pushEntity(e: entity, loc: location):
    set {_v} to vector from {_e} to {_loc}
    set {_v2} to vector from {_loc} to {_e}
    set vector length of {_v} to (distance between location at {_e} and {_loc}) / 10
    set vector length of {_v2} to (distance between location at {_e} and {_loc}) / 11
    push {_e} {_v}
    push {_e} {_v2}
#
    while amount of {kw.storage::levitateTargets::%{_p}%::*} > 0:
        send action bar "looping.." to {_p}
        loop {kw.storage::levitateTargets::%{_p}%::*}:
            if {kw.storage::levitateMode::%{_p}%} is "free":
                pushEntity(loop-value,{kw.storage::levitatePosition::%loop-value%})
        wait a tick
#

{_p} = player
{kw.storage::levitateTargets::%{_p}%::*} is a list of entities i'm levitating.

#

Is this enough info provided.?

analog karma
#

Yeah, wait a minute while I try something.

tawny anchor
#

Gotcha.

#

Feel free to ping me when you got anything. I'll be able to respond faster.

earnest lagoon
#

try setting the velocity not pushing

#

pushing adds

tawny anchor
#

O h .

#

That, makes alot of sense.