Trouble disabling physic for static mesh components using Blueprint

Hey ,
First: I tried to post this on the answerhub but I was having trouble submitting it as clicking the button at the bottom of the page did nothing. I had several friends try it as well and they experienced the same issue. Anyone know whats up with answerhub? I was able to post there before.

Anways, onto my question.

Please see the following:

The character in my game has a large sphere called GravitySphere. When this sphere overlaps with a child actor of type World_Item_Template it then adds it to an array.

I have an on tick event that then gravitates the items in the array to my Character’s position over time. This uses the native “SetActorLocation.”

This works when I have the single Static Mesh Component (CubeMesh in my below SS) of the Item to not simulate physics. However if I tell it to simulate physics the item will no longer gravitate towards my character. Does anyone have an Idea why this Happening?

Here my component for the Item.

Also, I am trying to also disable physics and collision on static mesh component for my Item once it begins gravitating towards the character. This way I can have objects that are affected by force and gravity up until they are being picked up and at that point they are only moving by my use of SetActorLocation.

However I cannot seem to get this to work. My understanding was that the root component of an Actor also updated all components under its ownership, but when I disable physics/collision it does not appear to be affecting the other components. In my above screen shot you can see CubeMesh is under WI_StaticMesh.

Here is a screenshot of me attempting to disable the CubeMesh collision by disabling WI_StaticMesh collision. I have also tried disabling collision using SetCollisionEnabled and this also appears to not affect the CubeMesh. Is this not how the root component works?

Any ideas on what I am doing wrong?!

Hello,
You need to get a “cubemesh” component instead of your “wi static mesh” component from your “cast to” and change its “set simulate physics”.

Hi MTree,

We are aware of the error with answerhub and want to assure you that we are working diligently towards finding a solution to the problem. Thank you for your continued patience while we get everything back to working order.

[=;178614]
Hello,
You need to get a “cubemesh” component instead of your “wi static mesh” component from your “cast to” and change its “set simulate physics”.
[/]

Hello ,
I am aware of this, however is not optimal in my situation.
I have a parent class for my Items and an individual sub-Class for each Item type that exists in the game world. The goal is to have all item types have their physics disabled and gravitate towards the character when in range.
Now normal OOP would say that since this mesh would be a shared characteristic for all my sub Classes then I should create it in the parent class. However when i do this I am unable to edit it in the editor.
Here is a screenshot of what I am referring too. I have created new static mesh component in my parent Class called “MyStaticMesh” but when I view it from the sub Class I cannot assign a mesh to it. I can set the values using a constructor but to set the mesh I would need to have a duplicate mesh which sorta defeats the purpose, unless there is a way to assign the mesh with a function that I am not aware of, but if so I cant see why I could not just edit in the editor then.

Screenshot (5).png

If I could figure out how to edit the mesh for this I can simply use the root component and not need the other 2.

But if I used your suggestion I would have to create a check for every single item type that exists, correct? That would mean I would have to update the code every time I added a new item.

Im sure there is a simply solution that is just a caveat to the engine but I have searched rather far and wide to no avail.

Also I would like to reiterate the other question in my post: Any idea why SetActorLocation breaks when physics are enabled on a mesh? I have some theories, but I wanted to make sure if this was intentional, a bug, or if I’m simply overlooking something.

I thank you very much for any assistance you can provide!

You are right that if you have no need of other components you’d better delete them.

To modify your blueprint.
Or in component tab, delete all other components then compile and save. You can drag the component you want to set as root to root and select “make root” when it does not do it automatically too.

Or (which can work to replace a blueprint with a totally different content, why i add it there) : Create a new blueprint, compile and save. Then delete your first blueprint, select “replace references” and select your new blueprint. It will replace all blueprints in all your levels using it.

edit : if you need your parent / child system : Create a new parent, with a box, a sphere or a capsule as root, and add your mesh to it like in a character. Then in your child set your mesh (at least in construction script) and replace old parent / child blueprints by new ones.

edit 2 : About the setActorLocation break, i am sadly not yet skilled to have the reply… I suppose that maybe there is a reference that blueprint lost on change, but this only an idea on the fly.

Hey ,
Thanks again for responding. I really appreciate your assistance.

[=;178832]

edit : if you need your parent / child system : Create a new parent, with a box, a sphere or a capsule as root, and add your mesh to it like in a character. Then in your child set your mesh (at least in construction script) and replace old parent / child blueprints by new ones.

[/]

You just described my current setup which is why I have the root component called WI_StaticMesh on my parent. The problem is I cannot add my mesh to the root (see screenshot in my previous post) from the child subclass through the editor.
I can certainly assign it through a constructor but this leads to some undesired results:

  1. I would need an extra variable to store the static mesh
  2. My items in the world editor would show up as using the default mesh of my parent and only update at run-time, defeating the purpose of the editor.
  3. My constructor would not only need to adjust the mesh of the root component, but every single property that is different (Scale, Physics, Collision, lighting, etc). To modulate this I would essential have to recreate the details panel for the component and have it set every single value through a constructor not to mention an extra variable would be needed for each one I wanted to adjust. This seams like an awfully large amount of bloat.

I could bypass all this if I could simply figure out a way for the editor to allow me to adjust the details for the inherited component or at least let the changes I make to the root component be inherited by the child components like in my first attempt. I would assume the first option would be a possible, but I cannot for the life of me figure how to do it? Perhaps some sort of override switch/flag?

Ok,
i am not sure this is your idea and what you want but :
Based on, first the mixamo character master / children (free added to project) and second the looman’s item / inventory system, [Tutorial] UsableActor system in Blueprint with multiplayer support - Multiplayer & Networking - Epic Developer Community Forums the way used to have it working fine seems to create a parent with or a root dummy (for inventory) or a main collision / physics settings (character) (but in this second case, root needs to fit mesh). Which in both cases will rarely be modified because the root component can’t be modified in some cases like scale or position in blueprint for example.
And all the effects function events that you want will be in your parent ( modifying collision or physics for the mesh component will works for every kind of mesh).
Then in your child, you define your mesh. Or directly in component tab if you can or with construction script, dragging the component and a “set mesh” which will no need an added variable. You’ll have to do that for each child but then you’ll can cast to your parent and each child in your level will works fine when you’ll cast on it and your parent and its attached functions. And if for some reason, your children have so much different settings, then set them in an array or use a custom event / function with dedicated arrays / variables created in your parent and set in your child.