#Dash with char:MoveTo (SOLVED)

1 messages · Page 1 of 1 (latest)

tired hound
#

im trying to make a dash with char:MoveTo to get a quick snap dash (so DONT suggest linear velocity unless you have a way to make it instant), im struggling mainly with weird interaction with walls and the dashes going up a slight bit

#

by weird interaction with walls i mean sometimes dashing through or to the top of the wall

#

this is the cutoff line btw char:MoveTo(Pos + Vector3.new(direction.X * ((10 * (i-1)) + (direction.X * (dist - 0.2))), -2, direction.Z * (10 * (i-1)) + (direction.Z * (dist - 0.2))))

keen marten
#

Either Humanoid:Moveto decides you can step over the wall or the physics teleports you there because of collisions. If it is the Humanoid:MoveTo, simply teleport by CFrame, then that lil jump, clamp the Y position so it stuck to the ground.

#

other wise teleport a lil before the wall, or slightly off the wall, you could simply have ur raycast length cover that "offset" distance

tired hound
#

dist is the raycast.Distance

#

and in the moveto formula i subtracted it with 0.2

#

doews that not work?

keen marten
#

yeah, teleport like dist - 0.5

rain ingotBOT
#

studio** You are now Level 9! **studio

keen marten
#

oh

#

mmm maybe

#

but wait lemmie check ur math because I didn't notice it 💀

tired hound
#

yeah

keen marten
#

ur formula basically says direction.X^2 * 0.2

#

which isn't like linear so ur offset will get smaller over the distance

#

so it aint offsetting 0.2 no matter what the dist it

tired hound
#

ah

#

lemme try to make another formula

keen marten
#

yeah but you can't just subtrack the Vector3 mind you

#

its lowkey tricky without experience with vectors but u can figure it out, else I'm here ig

tired hound
#

does this work?

tired hound
#

the distance and everything other than direction is basically multipliers

#

and the direction itself is converted to numval through .X and .Z (not using y value for now)

#

y is at -2 cuz of the dash abit up thing

#

i tested it just now and its around the same effect

#

the worst thing about the bug is that its super inconsistent

#

sometimes it works sometimes it clips

#

and because of that i cant really pinpoint whats happening

keen marten
#

yeah its just slight things, on the left expression, (direction.X * 10 * i - 1) is that you should direction.X * (10 *(i - 1)) so that you can dash 10*(i-1) studs foward

#

that should work i think.

tired hound
#

oh yaeh i forgot to add brackets there

#

trying it now

keen marten
#

sorry the formula works its just I wouldve instead, got the unit vector and multiply it by your dashLength which would be the dashLength = (base + dist - 0.2)

#

but like it works

#

If ur still gonne use MoveTo you might have to increase ur margin

tired hound
#

the problem is still here...

keen marten
#

try increase ur margin(0.2) before trying the teleport to CFrame

#

and be sure to apply the changes to ur Z too 💀

tired hound
#

yeah funny you pointed that out

#

my z had a .X 💀

keen marten
#

lol nice

tired hound
#

OK

rain ingotBOT
#

studio** You are now Level 14! **studio

tired hound
#

YES

keen marten
#

it works?

tired hound
#

WE GOT RID OF THE CLIPPING

#

but

keen marten
#

lol nice

tired hound
#

it still goes up

#

and it can still go to top of walls

#

btw i've tested using anchor before,

keen marten
#

I would just set the Y position to the starting Y position right?

tired hound
#

the teleporting to the top isnt beacuse of my teleporting to inside the wall and roblox bringing me up

tired hound
#

since im adding into Pos which is essentially base

#

but since dash is going abit up i made it -2

#

which didnt change anything weirdly

#

also by going on top of walls it LITERALLY teleports to the top of the wall NO MATTER HOW TALL IT IS

keen marten
#

well yeah but what else would change the Y position?

#

I think it is the MoveTo

tired hound
#

you suggest i use cframe instead?

keen marten
#

so I would, after the Move set the Position to the origional Y position

#

no u should be fine

#

although I wouldve, I just dont wanna change ur code

tired hound
#

hmm

#

alright i'll try that

#

DE.

#

DUDE.

#

THAT IS HILARIOUS

#

IT WORKS

#

IT FIXED BOTH ISSUES

keen marten
#

oh lol nice

tired hound
#

THANKS SO MUCH MAN

keen marten
#

I was afraid it wouldn't

tired hound
#

im gonna patch up some leftovers

#

BUT IT BASICALLY WORKS NOW

#

THANK YOU

keen marten
#

well if you should you can consider using like a tween and CFrames

tired hound
#

well not on this script

#

but for some reason when the player dies it like

#

gets offset or something?

#

im not sure what its about but i just avoid using tweens now

#

on characters specifically

#

and i tried cframes at first, some guy suggested i use :MoveTo instead tho

keen marten
#

oh it may be because of fall damage I would imagine

#

you'd prolly have to just disable fall damage during it

keen marten
tired hound
keen marten
#

lol thanks for telling me, ig I have some research

tired hound
#

oh boy.

#

ok

#

the clipping is back

#

i've tested, its because the raycast isnt detecting the wall for some reason?

#

and the serverside character is offset up

#

so like they're floating

#

Dash with char:MoveTo (STILL UNSOLVED)

#

might make a new post for this ngl

keen marten
#

yeah mabye

quiet compass
#

Just tween?

tired hound
#

uhm not the effect i was going for but its fixed now

#

i'll edit the title