Change collisions in ConstructionScript

Hi all!

I want to change collision state in depending on blueprint variable. Bu this code doesn’t work. Changing a variable “EnablePhysics” in an actor is completely ignored.

And i don’t understand why. By the way, collisions for sphere are full disabled, so they don’t affect to this code.
I hope you can help me understand the error. Thanks in advance!

@mdeni You’re using the wrong node, you need SetCollisionEnabled.

This node (SetCollisionEnabled) doesn’t work like the first.

@mdeni All your doing with the first node is toggling between the box collision ( as you have set it in the details ) and none. That’s best done with SetCollisionEnabled.

Sorry for my English, it is not my native language. Perhaps I made the wrong point. I mean, that SetCollisionEnabled does not work. As and first variant. Of course I tried it too.

@mdeni Yes, maybe we have our wires crossed here. What I mean is

  1. Set the box to block all dynamic in the details

  2. Use the set collision enabled node to run that off and on.

Yep. This is not working. :slight_smile:

Paste this Actor on any level. And in Details panel try to switch 3-4 times “Enable Physics”. After the second switch, the physics stops changing.

@mdeni I mean like this:

1 Like

There is no difference in your code and mine. :frowning:

@mdeni Well, there is. I don’t know how well that switch on bool is working.

Well, that was a bug in the engine. Don’t forget to vote!

Was anyone able to find a workaround for this?

I found a workaround. Copy the nodes involving “Set Collision Enabled” from your Construction Script to your Event Graph and wire them up to Begin Play (in your Blueprint).

Thank you, yep, ended up doing the same for the time being.

Still got error about collision.