#Debug boxcast

1 messages · Page 1 of 1 (latest)

devout leaf
#

I was trying to implement a wall jump into my 2d game, so I wrote a script to detect if the player is touching a wall with the right/left side of the player. For some reason the isTouchingWallRight() method is returning true when the player's left side collides with a wall

#

Here is a video of the problem. It doesnt really trigger continuously only when you move at a wall with the left side

#

There is also a gizmo that should be the same as the boxcast, so im really lost as to why its resulting in true

devout leaf
devout leaf
#

you mean like gizmos?

trim flame
#

is that supposed to be the yllow?

devout leaf
#

yeah

trim flame
devout leaf
#

wdym?

#

direction of what?

#

that is the right wall hit detection box

trim flame
#

draw out your casts accurate first

devout leaf
#

ive never used github

#

am i just supposed to download the zip?

#

alright thanks for this is looks hella helpful

rancid cobalt
#

but hes got a guide so follow tht prolly

devout leaf
#

i did

#

but like i still cant use the methods or whatever

rancid cobalt
#

did u include the namespace?

#

using Vertx. blabla probably

devout leaf
#

no i was gonna but i didnt know how to find that

#

i got it now tho you were right

rancid cobalt
#

is this not it?

devout leaf
#

Vertx.Debugging

#

yeah

#

thank you 🙏

rancid cobalt
#

thats what i was guessing while i was lookin at ur code

#

its probably the case of ur cast doing one thing.. and ur visualization doing another

devout leaf
#

like no hitboxes will show up no matter what

rancid cobalt
#

don't be sorry to us.. we're just tryin to help u out..

#

have u thought of trying adiffernt method of detection?

#

raycasts maybe? or overlapspheres just a suggestion

devout leaf
#

first i just wanna try and get the debugger to work

rancid cobalt
#

if not i'd def try to simplify ur problem first.. new scene, just two objects.. very simple.. and then use ur code

devout leaf
#

cause like idk what im doing wrong 😭

rancid cobalt
#

debugging sucks some times 😐

devout leaf
#

idk if ur familiar with the vertx thing

rancid cobalt
#

did u ever debug.log ur left condition?

devout leaf
#

but like this is what im putting into my code

rancid cobalt
#

if ur right is firing when ur left hits.. i wonder if ur left fires when ur right hits./..

rancid cobalt
#

never tried vertx stuff

#

OnDrawGizmosSelected() is my go-to debugging method

#

it will draw the gizmo's when the object containing them is selected.. and no other time

devout leaf
#

what does it mean by "selected"

#

like in the editor?

rancid cobalt
#

it means when the object is clicked on inside the hiearchy

#

yes

devout leaf
#

ah okay

devout leaf
#

idk like how do gizmos help you detect if things are colliding

rancid cobalt
#

it also has tons more than just Debug.DrawLine or w/e else it has

#

it will show you what ur code is doing.

#

but u have to code them to match

devout leaf
#

idk cause i like drew the gizmo where the boxcast was

#

but like i didnt see it colliding with the wall

#

so like what do i do from there 💀

rancid cobalt
#

im thinking ur boxcast isnt casting where u think its casting

devout leaf
#

what would cause that

rancid cobalt
#

i watched the video and i dont understand it either

#

just the wrong code..

#

-x instead of x, simple mistakes..

#

i dont know specifically in ur case...

devout leaf
#

yeah dw ur good

#

i was just thinking maybe someone had a similar issue or smthg

#

ill prob just have to try other collision detection methods like you said

rancid cobalt
#

are ur layer masks set up correctly?

#

imma play around with the code u sent here in a minute to see if i can't pick up on wats wrong

#

im not usually a 2d designer.. but i can open an empty project atleast and see.. what is ur wall? and ground? what kind of colliders do u use on those things?

devout leaf
devout leaf
#

on both

#

picture of the collider settings

rancid cobalt
#

thanks!

#

i'll see what i cant figure out here in a bit

devout leaf
#

no worries

#

youre way too kind, thank you so much

rancid cobalt
#

np, u just keep trying to figure it out on ur own tho..

#

b/c i cant promise i'll know whats wrong with it

devout leaf
#

yeah its all good

#

youve already helped me way more than enough

devout leaf
#

pretty sure i figured out what was causing the issue

#

thank you for all your help

#

do you know how to fix the issue tho

#

im pretty sure that if you move too fast you clip into the wall which causes it to think youre hitting it from the right

#

idk if this is a common thing or nah

devout leaf
#

alright i just switched the rigidbody collision detection on the player to continuous instead of dynamic and that seemed to work