What is the best property to change in order to make static mesh components on a blueprint appear/disappear during live game? I made a script toggling “hidden in game”, and it works, but the invisible static mesh components still have collision. Even when I set the components to have no collision, and uncheck ‘auto weld’, they still have collision.
How are you disabling the collision? I disable and enable collision dynamically on my laser fence to allow people to walk through it when it’s off, but block passage when it’s on.
set visibility make sure u have the mesh selected in the graph it will still keep the collision
WM, I turned the component’s collision off in the editor by setting the it to the “no collision” preset, but I think in your case you are setting collision for the entire BP, not individual components, right?
Also, I’m wondering if there’s a better way to add/remove parts from a structure than hiding them, since I will have about 12 static mesh components added to the root, which could slow things down.
No, my fences have multiple components each. The largest, and most important, is an invisible collision wall that allows me to overlap players so allies can walk through, enemies are destroyed, and dino’s (as they do not overlap) “hit” the wall and if they’re allied the collision will change to allow them through and after a microsecond passes blocks passage once again. I intend to swap this out for individual collision elements around the beams - allowing projectiles to pass through gaps but destroyed if they hit any beam - once I get back to active development of that mod.
There are various ways to add and remove components and meshes. You can spawn/attach-to for example. Stored references of the meshes would be appropriate there.
For example of my dynamic collision:
Handling dino collision;
Absolute collision based on activated/powered status;
I’ve noticed that 9/10 times, you do not post images of what you’re doing, this makes trouble shooting a visual scripting system extremely difficult - for obvious reasons.
It would also pay to look at the static mesh asset itself and look at the collision settings on the source file, not just the component settings. You may have missed something.
You will also need to make sure this is a multicast(reliable) event being called from the server so that both server and client receive this information or it can be glitchy.
If you are running off Event Begin Play, you should do something like this.
Authority=Server side calls/code to run, Remote=Client Side.
The remote is mainly for clients that are coming into range of the actor, they will execute the remote leg of the branch. Which leads to this.
The server should also update any clients the are already in the area, which is the Authority leg of the switch coming off Event Begin Play, and this is done with a Multicast Event, which should only ever be called by the server, which we are doing in this example. Keep in mind, you should always pass any non-replicated variables to the clients through the Inputs of the Event call. Such as this.
Add in Set Visibility for your setup, and you should be golden. ORP’s force field works off these principles, along with the color changing of the field when a user is looking at the AOE for placement of the ORP pillar.
Thanks for all the help guys. The networking stuff is definitely new to me so I will have to go over that a few times until I understand it. I ended up using the static mesh instancing component that can add/remove multiple instances of a mesh.