#Dash problem
1 messages ยท Page 1 of 1 (latest)
is this just like a channel ?
yup
Oh cool
easier to look at
lemme show you something
the box's y value is 7, but the player should be able to jump right?
Yeah
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
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 ?
no
in 2D, its reccomended to do the thing called raycast
its pretty damn easy also
want me to show it?
if you have time yea !
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
Okk, i don't understand anything of the Physics2D Raycast hahaha, i should look a video for this maybe
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/
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท...
and the dash problem. Try changing the dash key to E or something
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
uh
you could do this
ray = Physics2D.raycast(player.transform.position, player.transform.up * -1, 0.0001f);
So the code work but canJump is never true
I make the Tag and set the ground with it
yeah? that should work