Help with item gravity actor component

So recently I’ve been trying to make a actor component that when attached to an item would allow it to be affected by gravity but it hasn’t been working as intended and I’ve been getting the following error in the Message Log:

Based on the error message, it would there’s something wrong related to the ‘Physics Target’ static mesh component variable but I’m not experienced enough with type of stuff to know what the problem is.

Does anyone have any idea on what is causing error and how to fix it?

component_hierarchy

Assuming the Falling Movement is AC_BP_Falling_Item, you’d need need to point the reference at something as currently it’s null. So in the component:

The above assumes the root is a static mesh, which it is in scenario.

Essentially, the component does not know it is a part of something else, we need ask if there’s a parent and point at the parent’s entity.


Save these for later:

Oldies but goldies.

1 Like

Sorry for the belated response, but anyways thanks for the help as your solution worked, however, there’s another issue that I need help with. I tried to attach the item gravity actor component to my health pickup blueprint, the same one from topic, but it doesn’t work for some reason.

I assume the issue is somehow related to the fact that the health pickup already has a actor component attached that is responsible for the health pickup’s squash & stretching animation.

actor_component_failure

You can have as many actor components as you want. But if one is pulling the actor to the left and the other one to the right… the actor will stay in the middle.

Perhaps something is conflicting. Judging by …

…and the component hierarchy in you pic, should not work. Your root is a Scene Component while expects a static mesh in its place, as mentioned below that image:

The above assumes the root is a static mesh, which it is in scenario.

For bit to work you’d need to make the Blueberry the root. But that will conflict with the bouncy / stretchy bit as it relies on relative values which we’d lose.


But how would that work? You want an actor that is stretching and bouncing around while simulating physics? Is supposed to be soft body simulation?

You could probably achieve a somewhat plausible effect with Collision Sphere as the simulating root while the parented static mesh is doing its relative thing. But at point I’m not sure what’s the end effect you’re after. You may need to clarify.

1 Like

No, its not supposed to be a soft body simulation. I just want the squash & stretch animation to be able to play while its falling.

Then it’s as above. Sphere Collision (or box) as the root, with blocking collision & simulating physics. Plus a Static Mesh with no collision, attached to the above root, animated in the relative space by an actor component. You can get component child(ren) like so:

image

Edit: you could have both - the gravity and the scaling deformation handled in the same actor component. Two separate components might be better if there are entities that need only one feature or the other.

1 Like

Okay, I finally got around to trying to fix the item gravity issue again & I finally got it to work by following the above advice.

Thanks for all the help! :smiley: