Download

Can't click on static mesh in game after SLEEP of physics object.

Hi all,

So I’ve researched this for a couple of days now and have found nothing. It seems that for some reason my object in game can’t be clicked on after I enable then disable physics on it. The following screenshots I’m going to show you are with “show CollisionVisibility” toggled “ON”. So here’s what’s going on:

I have a MainCharacter and a Tree:

7173632d65ebb50beceb870d44992031eb0ca2de.jpeg

I right click the tree, the MainCharacter comes and chops it. When the resources are exhausted I enable physics and fire an impulse to knock it over:

3.jpg

As soon as the tree goes to sleep (EVENT ON SLEEP) the trunk turns blue (But I believe this is because I have a dynamic material on it. I also removed the material so the trunk stays purple and I still get the same problems):

2.jpg

And after it goes to sleep the tree returns to its original position via this BP:

4.jpg

Then the tree starts growing via this BP:

6.jpg

And the start growing func:

7.jpg

So doing more tests, it seems that I can click on the tree no problem until the END of the “Start Growing Func”. I disable “Is Growing” and the “Event Tick” stops calling the “Start Growing Func”. After this I can not click on my tree anymore.

I print out what the cursor is hitting by channel (Trace Channel set to Visibility) and what prints out is my landscape when I click the tree (it should print out the TreeBP). The last pic is just the collision preset of my tree:

8.jpg

I’m wondering if by scaling the tree I’m messing up the collision mesh somehow…or something. Honestly I have no idea and have run out of ideas. Sorry for the many pictures but I am completely out of ideas. Thanks for any input!

Update:

Alright after some further testing I seemed to narrowed down WHAT is causing this to happen, however, not really sure WHY.

First off, it’s not because of the tree going to sleep (at least I’m pretty sure not). So I’m enabling and disabling physics on the simpleTreeShaft (no other components). If I have ANYTHING parented TO the simpleTreeShaft, I can NOT click on the tree after it’s done growing.

1.jpg

If nothing is parented to the simpleTreeShaft I CAN click on the tree after it’s done growing. So uhhhh, honestly, this doesn’t really make sense to me. Anybody have any thoughts?

The only thing I can think of is that I’m scaling the tree by just using SetWorldTransform on ONLY the simpleTreeShaft. But still, doesn’t really make sense as to why I wouldn’t be able to click on a tree after scaling it:

1.jpg

Boom chucka, finally figured it out. Man what a pain. I found one other person that was having the same problem as me and it seems that the problem was when I was DISABLING PHYSICS. Apparently, according to the other guy’s forum post, when Physics gets disabled, the Visibility Collision Response is always Ignored? Even though I was printing out “GET COLLISION RESPONSE” in the visibility channel and it says BLOCKED. So what I had to do was use a physics handler. For anyone that is interested, I basically have to have physics enabled ALL the time for my trees but have “Grab Component” ON (to keep it still). As soon as I want it to move I do “Release Component.” Here’s a nice tutorial I found:

https://www.youtube.com/watch?v=OltZ-xFz8IQ

It seems that I should be able to disable physics and not have the collision response for visibility be ignored, even though it says it’s still on “Blocked.” Is this a bug? Your guess is as good as mine.