#Issues with CollisionShape3Ds appearing to be in one place with the Debug outlines but actually not

28 messages · Page 1 of 1 (latest)

noble mortar
#

I attempted to temporarily "resolve" it by just setting the height to 1000 (shape.height = 1000) before the check, doing the check, and then setting it back to 10 but for some reason that also doesn't work. When I set the height to 1000 in the inspector, and then run the game (EVEN WITH THE ABOVE HEIGHT CHANGING CODE), it all of a sudden works.

I feel like this should be telling me something obvious but I'm just not experienced enough to know

noble mortar
#

I'll try to show some screenshots to demonstrate I guess

#

Each of these three things can be interacted with to grow a patch of flowers

#

The one on the left makes a line while the middle and right one do a circle

#

They each have Area3D1 which is exactly the shape in the X and Z dimensions of the patch of flowers they produce, and 10 units tall; it is usually on Layer and Mask 3 but I change it to 10 during the execution of this event

#

They also each have Area3D2 which is a small cylinder stationed at the location of the original interactable object and is also 10m tall but is always a radius 0.5 cylinder. It is always Layer and Mask 10 only.

#

Normally, when the player looks at one of them an outline appears indicating that it is interactable. However, when one is surrounded by a field of flowers that is of a different color, it should become uninteractable.

#

As seen above^, the line-shaped patch currently works correctly and is preventing the blue flower from being interactable.

#

That was my first example from above where originally it was broken but I solved it by just resetting the position of the CollisionShape3D in code on ready()

#

However, the round ones are broken. Despite using the same code (which I have confirmed works), they do not "disable" the interactable of the opposite color

#

^This outline should not appear

#

In order to implement this, I have the Area3D1 change to Mask 10 and check for overlapping areas; if it finds any that have certain meta values it can do what it needs

I have confirmed that the line-shaped one's Area3D1 works properly, and detects the Area3D2 for itself and the other two interactables.

#

For the round ones, though, their Area3D1 does not detect anything else; not other interactables' Area3D2s, nor even its own.

However, if I change its Area3D1's CollisionShape3D's shape's height to 1,000 or 500 instead of 10 in the editor before running the game, it works properly. Notably it does not work for 100.

#

It also doesn't work if I change Area3D2's shape's height to 1,000 for all of them for some reason.

#

That's my long summary, sorry haha

#

I tried replacing the Area3D1 for the round one with a copy of the Area3D1 from the line one and it didn't work, so I'm wondering if I may have made a mistake somehow in the code.

Still weird that it would work by increasing the z height of the shape to 1,000

noble mortar
#

It does work if I use the code to set the Area3D1 shape's height to 1000 just before the execution and then set it back to 10 after; it's not an elegant solution and I'd still like to try to figure out why the heck this is happening

fallow swallow
#

is maybe some scaling in play? In my experience scaling can be a bit tricky with physics in what it affects and what it doesn't

noble mortar
#

I thought so too.

#

Interestingly what I found is that there are 2 things that solve it

#
  1. Setting the Area3D1's Mask to 10 in the inspector pre-launch and not changing the code at all
  2. Changing the Area3D1's CollisionShape3D's height to any other value and then back to its original value of 10 in the code just before activation
#

My only assumption is that somehow it's not actually changing to Mask 10 even though i tell it to in the code and wait a process frame after doing so