Does this seem like intentional behavior with raycasting?

I remember reading something in regards to changed behavior with :Destroy(), but as far I remember I feel like the changes were supposed to silence these issues, but I could be wrong on that.

So I have an interaction system. You can interact with these drawers. I’m working on adding a feature where collectibles can spawn inside of those drawers that you can collect.

Now, the client caches these drawer objects in order to manipulate their CFrame to handle the opening/closing animations. (Note that the collectibles are parented into the drawer so that the collectible moves when the drawer moves)

To get to the point, when the drawer opens and I interact to collect the collectible inside, the interaction system I have still thinks the collectible is inside the drawer, despite it being destroyed.

I’ve verified this trying numerous approaches such as having the server relocate it to somewhere completely off the grid, but on the client the ray still is hitting the non-existent collectible, preventing me from closing the drawer.

This sounds like odd behavior for raycasting. I get the reference to the object still exists, but why would that effect the raycasting engine? The instance itself no longer is parented.

I can clarify on anything if needed. Does this sound like intentional behavior with the engine?

Thanks a lot. :slight_smile:

Could you show the raycasting code or an image of the explorer, if the collectibles are destroyed the ray should not detect them meaning either they are not destroyed or youre destroying the wrong thing, it could also be that the ray is ran server side and your destroying client side but i doubt it, either way could you show more?

1 Like

Honestly there isn’t a whole lot to show. The raycast is done client-sided, and I can assure you the correct object is getting destroyed.

Well you asked wether this was intentional behavior its definitely not, im note sure what’s going wrong but I cant help without knowing what youre actually doing code wise

1 Like

I figured out the mystery. I did some debugging and I was reminded that I took a part out of the collectible model after it gets picked up, and that was kept in order for the sound in it to keep playing while the rest of the object was destroyed. This was never discarded, causing the ray to hit it.

I spent all day on this :sob:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.