[Bug] Physics and Mouse Click/Camera Move Issue

O/S: Windows 10
UE4 Version: 4.14.1

I just noticed this bug playing around with my physics bodies in my project. The first issue is that my stack-able chips are falling through each other during gameplay when stacked. This shouldn’t happen. The second issue occurring is when I detach from player controller and right-click, move the mouse, or move the camera all the physics bodies that are in the scene bounce. You’ll notice when the cross-hairs disappear, I’m right-clicking. When this happens, the whole stack of physics bodies starts to compact and when I release they bounce up.

I’ve uploaded a video to YouTube to show a visual.

Hey Element808,

Could you please provide some further information regarding your setup? Are these objects imported static meshes or are you using default UE4 assets?

Have you made any additional alterations to the objects other than just simulating physics on them?

Are you able to recreate those assets and get the same behavior to occur in a clean project? If so, could you please provide a detailed list of repro steps?

Aloha Sean,

I’ll test it out in a clean project, ASAP. I’m needing to do it anyways, because I’m unable to deploy to mobile because of the error:

“LogCook:Warning: Found unparsable ini setting Windows.EditorPerProjectUserSettings:AssetEditorToolkitTabLocation:/Game/PuzzleBP/Maps/TestLevel.TestLevel:PersistentLevel.TestLevel:0 for platform Android, invalidating cook.
PackagingResults:Error: Error Launch failed! Unknown Error”

I’ll report back as soon as I recreate everything in a brand new, blank project and test it out for you.

Sounds good, let me know what results you see in the clean project.

Aloha Sean,

I’m having some really bad issues in my new “Blank Project”. It’s like one thing is leading to another. I’d post a link to that new issue, but it’s unrelated, and I don’t want this issue to become off topic. However, the new issue in a blank project is preventing me from advancing progress in this issue.

Gotta give me a bit more time. Sorry for the delay.

No worries, let me know when you have more information, and if you could even provide the zipped up test project, that would be fantastic.

Thanks

Aloha Sean,

Ok, so here’s the zipped up test project: https://drive.google.com/open?id=0B2D_iSIrOpwAdVZ3aThucHdINVk

This is a very cut down version of the whole project. I just don’t want my game source being made public; however, the important parts that I was able to replicate in a blank project that highlight the issues are there.

Everything in here is stock UE4, except for the sidewalk static meshes, the POG static meshes, and textures.

Please also view this gameplay mock-up animation of what I’m trying to achieve for this project, and it might help you grasp the context of my issue a little better: https://youtu.be/bWs1EA5tEpU

NOTE The gameplay mock-up video obviously doesn’t have any true physics applied, but that’s what the gameplay should be like.

As a reminder, there are 2 things I’m having issues with that are probably related to this physics issue…

  1. The objects in the stack, after being spawned via Spawn_POGStack blueprint, collapse into each other’s collision, start bouncing around, and slide all over the place. The stack of 20 objects should rest on top of each other, but still have physics applied. The other part of this is that another object will be slamming down on top of the stack (essentially trying to get them to flip over), so physics to in this case is paramount to my project’s success.

  2. Once detached from the controller the objects in the stack start bouncing based on camera movement and mouse clicks (more obvious with a right-click). The issue does occur with a possessed controller, but I have the camera locked in place for my project.

I really appreciate you taking the time to look into this for me. If there is anything else you need from me, please let me know. If you need anything from my main project, I can provide that, but my only request is that I be able to share it privately.

Mahalo,
Jordan

After looking at the test project, I don’t believe that this is a bug. I think it’s just related to the trickiness of working with physics objects, especially when they’re as thin as what you have in your project.

I played around with the object a bit, and made a couple of changes that led to not perfect, but much better behavior.

Here’s what I did:

Removed the addition of the PogSpacing variable and just plugged the actor location into the Spawn Pog node. This meant that they wouldn’t have their locations set and instead would spawn and stack on their own.

I removed all collision and used Auto Convex Collision to regenerate collision on the static mesh.

I also increased the mass of the object to 8 or so.

Finally, I made the Pog mesh the root component of the actor, as objects that are simulating physics are detached from the root anyway.

Give that stuff a try and you should see slightly better behavior, but I think it will definitely take some more tweaking to get it to work the way you’d like it to. Let me know what you think and if you have further questions and I’ll be glad to do my best to help.

So I made the changes you did, and I see how you thought it might have been a bit better. I’ll try to explain…

When you plugged the transform directly into the spawn actor node, it made the POGs really tiny (original 3DS Max export scale) because it was defaulting scale back to (1, 1, 1). While it may to have appeared looking good, when I zoomed in (via ejecting from controller) they were almost all inside of each other, most ignoring all collision between one another.

I thought, "maybe it was because the scale of the object (like you said) was too small and physics/collision was having a hard time, so from the Spawn actor location node, I made a new transform and plugged in (3, 3, 7) for scale.

This made it a a good testable size. The video below shows the results of this change, along with all other changes you suggested).

It bounces like crazy, still! Back to square one…

HOWEVER, I did make some discoveries with further testing. In the first few seconds of the video, you notice how the POGs are perfectly stacked? That’s exactly how it should look! But, the problem is, I only happened to get this result because at the time, my screen capture software was counting down to record and it was taking away control of application focus to the editor, before PIE was able to actually run my game. As soon as I escape the project and press Play normally again, the same crazy bounciness issue occurs on my POGs. I also proceed to show how moving my mouse around, right-click holding and releasing, initiating a bounce from nowhere. If I stop moving my camera, or the mouse, it settles down and doesn’t do anything.

I tested this further after the video ended and ran it as a standalone game. As you are aware, standalone games never start with focus. I got the result I was looking for. So something is different from running in PIE and standalone, and I think it has something to do with the focus on start. Let me know!

Sorry for the delay.

After further investigation and discussions with our developers, it appears that this behavior is due to the fact that the meshes are quite small. PhysX is meant to be stable, but is not meant to represent real world physics perfectly.

The suggestions that I received from the developers were to either pre-animate this and have multiple animations ready to play randomly when the stack is hit, or to try and dramatically increase the size of the objects you are working with, as well as the scale of the entire game, which can typically help with issues such as this.

Also, check your spawner to ensure that you’re not spawning any of the objects inside of one another and that they are receiving adequate space so that they don’t pop through each others’ collision.

I also found another thread where a user is working on a similar setup and found a solid workaround: https://answers.unrealengine.com/questions/79948/small-object-physics-simulations.html

Finally, if you don’t want the viewport to receive focus automatically during PIE, you can disable this by ensuring that the Game Gets Mouse Control option is disabled in Editor Preferences->Play. This should prevent it from receiving focus until you click on the viewport.