Skip to content

u/AgentParsec

In this archive from Sep 2023 to Mar 2026

21
posts
5
comments
11
media
158
score
4 saved before deletion

So I can tell which side is being interacted with. If it was only one, it would register the same raycast collision regardless of which side the player is on. And I don't want to have it use the player's position relative to it, because the orientation of the object could change. With one on each side, I pick up which one the raycast hits and use the interaction with that side.

1 points

Basically it's a flat wall segment that can be interacted with on either side for two separate interactions. At the root of it is a simple Node3D, whichis what the two StaticBody3D's are attached to. There's a script on the Node3D which is used for positioning the object, storing relevant variables, etc. When the player gets close to the wall from one side, a raycast interacts with the static body on that side, which then needs to access and return information from the Node3D's script.

I know it's bad practice to use get_parent(), but I don't know of an easier way to reference the Node3D's script without putting extra scripts on each of the two StaticBody3D's that point back to it, which seems inefficient.

1 points

End of this list.

Back to top

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.