#Game

1 messages · Page 1 of 1 (latest)

floral oar
#

e

mellow solar
#

Anyone

#

doesnt matter

#

Player

floral oar
#

ok i named it player

mellow solar
#

did you add the player gameobject

#

in the dropdown

#

as Player

floral oar
#

.

#

im sorry

#

my brain is just malfunctioning

#

what dropdown

mellow solar
#

the one u just showed me

floral oar
#

oh so i select it there

mellow solar
#

you need to add the player in it to be ignored.

#

the ray wont know player is in a different layer unless you add him there

floral oar
#

shud i change it to all children or just the parent

#

just the parent right?

mellow solar
#

the colliders of the player

#

any colliders on player

floral oar
#

ok so just the parent

#

and by parent i mean the player gameobject

#

not the raycastpoint thats a child of it

mellow solar
floral oar
#

ok

mellow solar
#

it will be ignored anyway

floral oar
#

so ive done that

mellow solar
#

you add the field to your raycast

#

and add Default layer in the inspector for the script

#

but not player layer

floral oar
mellow solar
# floral oar

right, did you add HitCollider on the raycast 2d ?

floral oar
#

uh no i havent yet

#

its still the same

mellow solar
#
public static RaycastHit2D Raycast(Vector2 origin, Vector2 direction, float distance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, float minDepth = -Mathf.Infinity, float maxDepth = Mathf.Infinity); ```
#

dont copy this

floral oar
#

ok

#

wait

#

are those the arguments

mellow solar
#

that is the signature for layermask

#

yes

#

for layermmask

#

you only need distance before it

#

and ur done

floral oar
#

what do i do with distance

#

i dont know anything about that

mellow solar
#

make it the maximum amount you want the raycast to travel

#

aka to detect isgrounded

floral oar
#

idk what the maximum amount would be

mellow solar
#

usually 1 or less works

floral oar
#

oh

mellow solar
#

thats up to u

floral oar
#

yea but the thing is i cant visualize that, usually it helsp to understand through visualization but this is pretty new to me

#

so

#

yea

mellow solar
#

but i sent u a link

#

to debug.drawline

#

which you add those same values to as ur raycast

#

or debug.drawray sory

#

you add the same values as ur Raycast2D

#

and you visualize it

#

the float is duration on screen, but if you multiply direction with * maximumlength from 2d ray

#

u can see it

floral oar
#

im assuming dir in the docs is going to be my distance value?

mellow solar
floral oar
#

idk where to put it

mellow solar
#

its not about where to put it

floral oar
#

i though tit was gonna draw a ray

mellow solar
#

yes

#

in update

floral oar
#

but it didnt

mellow solar
#

but you still need the correct values

floral oar
#

what are the.

#

.

mellow solar
#

ray takes in a direction

#

look at ur 2D raycast

floral oar
#

oh i do

#

-Vector3.up

#

or .down

mellow solar
floral oar
#

nope

#

eh its fine

#

ill learn this some other time

#

its getting late for me anyways

#

thanks for sticking with me tho

#

it was probably frustrating for you and i apologize but unity is still pretty annoying for me

mellow solar
#

nah its pretty close tho

#

I can show u

#

one sec

floral oar
#

nah i mean its fine i wanna save you the trouble

#

it was just an attempt anyways to see if i could make a simple platformer from scratch but still a few holes here and there

#

thanks tho

mellow solar
#

its no trouble

mellow solar
#

thats to see it