#Dash problem

1 messages ยท Page 1 of 1 (latest)

tardy vessel
#

this is how threads work

pearl ether
#

is this just like a channel ?

tardy vessel
#

yup

pearl ether
#

Oh cool

tardy vessel
#

easier to look at

pearl ether
#

So the Dash Work sometime

#

But not all time

tardy vessel
#

think it conflicts with jump

#

AND

#

thats a terrible way to do ground detection

pearl ether
#

Why ?

#

I just look a tuto on youtube i'm new to unity

tardy vessel
#

lemme show you something

#

the box's y value is 7, but the player should be able to jump right?

pearl ether
#

Yeah

tardy vessel
#

in your logic(Mathf.Abs(rb.velocity.y) < 0.001f)

#

the player won't be able to jump if they are on the box

#

you gotta do something called raycast in this case

pearl ether
#

For the jump i check the Velocity so he can jump if he is on box

#

On the box his velocity is still 0

#

And Y position at 7

#

No ?

tardy vessel
#

no

#

in 2D, its reccomended to do the thing called raycast

#

its pretty damn easy also

#

want me to show it?

pearl ether
#

if you have time yea !

tardy vessel
#
bool canjump;
raycasthit2D ray;
Physics2D.raycast(player.transform.position, player.transform.up * -1, out ray, 0.0001f);
if(ray.transform.CompareTag("ground"))
{
canjump = true;
}
#

its like this

#

instead of Mathf.Abs(rb.velocity.y) > 0.001f, just put canjump == true

pearl ether
#

Okk, i don't understand anything of the Physics2D Raycast hahaha, i should look a video for this maybe

tardy vessel
#

its a 3d version, but it will help

#

Let's create a shooting gun with muzzle flash, impact effect and force.

โ— Sci-Fi Weapons: http://devassets.com/assets/sci-fi-weapons/
โ— Medieval Arena: http://devassets.com/assets/medieval-arena/
โ— Western Props: http://devassets.com/assets/western-props-pack/

โ™ฅ Support my videos on Patreon: http://patreon.com/brackeys/

ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท...

โ–ถ Play video
#

and the dash problem. Try changing the dash key to E or something

pearl ether
#

Ok i will see the video just after i try to change the key rn

#

Changing the Key don't solve the problem, maybe it's cause of the Mathf.abs velocity

#

And the code for Raycast is not good

tardy vessel
#

uh

#

you could do this

#

ray = Physics2D.raycast(player.transform.position, player.transform.up * -1, 0.0001f);

pearl ether
#

So the code work but canJump is never true

#

I make the Tag and set the ground with it

tardy vessel
#

yeah? that should work

pearl ether
tardy vessel
#

wait

#

oh

#

make a new object under the player

#

shoot raycast from there

#

wait can you friend req

#

i gtg

#

I will help you later