#Detect an angle through collision

1 messages · Page 1 of 1 (latest)

gritty jasper
#

i am doin some walljump type shi and i need to know the angle of a face the player just touched. i believe it could have something to do with normals, NormalId, but idk abt that :'P

#

this is related to the player btw so it should run in a local script

#

i have looked everywhere and i cant find stuff

frigid summit
#

then get the objects position - players position to get forward vector between the wall and player

sullen garnet
#

raycast forwards from primarypart of character upon touching

#

then get raycast.Normal

sullen garnet
#

that would just increase delay between jumps by about two frames or more

#

unless of course you are using server-authenticated movement, but nearly no game on roblox does that

gritty jasper
#

but i need the angle of the specific face

#

since parts have 6 faces

sullen garnet
#

blocks have 6 faces

#

raycast will still give you the correct angle

#

you just have to convert it from the normal

gritty jasper
#

oooohh

bright sentinel
#

Could you elaborate

sullen garnet
gritty jasper
neon beaconBOT
#

studio** You are now Level 1! **studio

gritty jasper
#

yay !

gritty jasper
#

the face and the angle its facing

sullen garnet
#

you can't get a particular face as there is no face object/id/etc. in roblox but you can get the angle at the point of intersection between a ray and a face

#

what i said earlier still stands just for clarification

bright sentinel
sullen garnet
gritty jasper
#

so like the point has the angle of the face, correct?

sullen garnet
#

it depends on the exact implementation, but i believe it's probably normal for the C++ backend to construct the face from triangle vertices

#

if you have no idea what i just said, that's fine, you don't need to know

gritty jasper
#

lol okay

#

im assuming it works good with baseparts but not meshes?

#

bc i wasnt planning on using meshes at all so its fine that way

sullen garnet
#

it works with everything

gritty jasper
#

cool !

#

thanks dude

sullen garnet
#

however if you mess with basepart fidelity it may affect raycast precision (i think, i haven't used roblox in a while)

bright sentinel
sullen garnet
#

like it's the whole harry potter castle

#

the collision will be precise, or it could just be a cube

#

that is what fidelity is

gritty jasper
#

ooohh okai okia

#

im getting strange stupid errors

#

should include all this actually

sullen garnet
#

CFrame:lookAlong(tor.Position, raycastResult.Normal) would work unless raycastResult.Normal is a table lol

#

i am a little confused as to why you chose to use torso but 🤷

#

oh wait

#

lol you did CFrame:lookAt

#

it's the colon

gritty jasper
#

huh

#

i am defaulting the character to R6 btw

gritty jasper
#

personal nitpicks tho