Inu Games - Modular Snap System Runtime

I tried to build and submit it but there is some weird problem between ue4.25.3 and VS2019, for some reason unreal want VS 2017 now. With 4.25.0 everything worked. I asked here

But its released for 4.24.3 ? Thats the engine i have to work with :slight_smile:

I found the problem, they ninja-added some new build parameters in 4.25.3 but never told it to nobody. Now I will package and submit it.

Okay, version 1.1.3 with ISM support submitted, waiting for the marketplace approval
I will put the new example when the plugin is updated

Version 1.1.3 is published, it includes ISM support. The example project and demo on itch.io are updated too, check the “ISM” map for an example of how to use it:

I hope everything works alright!

@ What would be the best way to apply scale to a group of snapped objects ?

Let’s say I snapped 3 cubes together, to have a nice cubic bar, and I now want to make it bigger.
Should I detach all actors, scale them up, then try to re-attach them together ?
Or is there a better way to do it ?

Thanks.

Hi Entilzar,
I’m not sure I 100% understand the problem, but if you have 3 actors attached you need just scale the root actor and the children will scale with it automatically. So, no, you should not detach anything I think.

Yes, thank you, it worked quite well just by scaling the root actor.
It’s not perfect however, as I encounter a strange behavior afterwhile.

What I do is quite complicated, I admit, but to sum it up quickly :

  • It’s a VR app
  • When a hand tries to grab an object held with the other hand, but with Scale Mode actived (via a button), I change the material of the Held Object and all its snapped object (to show it’s possible to scale them)
  • To do that, I find the Top Pickup Parent, then I Explore it to get the arrays of Connected Actors, and I change their Material too.
  • If Grab occurs, instead of really grabbing the object and switching hands, I start my Scaling procedure. The tricky thing is I cannot use the Held Actor directly (jittering occurs), so I duplicate the Static Mesh components and operate on them, while hiding the real Held Object and its children.
  • Then, when the Scaling hand finally opens up, I apply the final Scaling computed value on the Held Object and show the real Held Object and its children back.

Problem is, with my 3 object-bar :

  • When I hide the Held Object, the result array of Explore contains 2 items, each connected to 2 Actors.
  • When I try to show them back, the result array of Explore contains 2 items, each connected to 0 Actors.
  • But if I try to Scale again the Held Object, the result array of Explore contains 2 items, each connected to 2 Actors !
  • And of course, after the Scaling, the result array of Explore contains 2 items, each connected to 0 Actors…

So, there is definitely something going wrong with what I do.
I managed to get approximately what I want by keeping track of objects set invisible, but I suppose there is a way to do it properly.
Also, I tried to Rebuild Explored after Explore, but it’s not better.

I probably have a misunderstanding of how I should to that :slight_smile:

By Explore your mean the “MSSR_Helpers:: Explore” function from VR examples project? This one is pretty specific to the realistic detach example, it breaks attached actors in subtrees connected by mssr sockets. Because of that it supposes the actors are all correctly set up with collision and other stuff.

If you simply need to find all actors attached to an actor you don’t need something as complicated as this. You can use basic UE4’s GetChildrenComponents or GetAttachedActors blueprint nodes.

Ok, I now use GetAttachedActors in a recursive function to get children of children, and it’s cleaner.

However, one big bug remains : when I apply scale to my 3-cube bar (composed of Cube1, Cube2 and Cube3), sometimes (difficult to know when that happens), Collisions on the Static Meshes of the snapped Actors I’ve just rescaled are completely messed up.
If I use the console to Show Collision, all is displayed as expected, but when I try to Grab one of the snapped Actors (say Cube 2), either no Collision is detected by GetActorNearHand, or if a Collision is indeed detected, the actor and component returned are from one of the others snapped actors (Cube 1 or Cube 3), not the one I try to Grab. When this occurs, if I try to Detach one of the snapped Actors I can Grab, I may get a Warning concerning the Actor I cannot Grab : “try so Simulate Physics but No Rigid Body”.

So visually all seems correct, but “physically” objects are not where they seems to be.
It’s a problem because I cannot scale them again, and snapping and physics do not work properly with the “ghost” actors.

I don’t know whether this is a UE4 or a MSSR issue, but maybe you have already experimented that kind of bug.

Yes, I know that bug. UE4 is not very robust when attaching and detaching physics actors, it’s pretty easy to have this problem.
In my experience there are 2 things which will cause the bug:
It can occur if the “auto weld” parameter in sm actor physics properties is disabled, so make sure it’s checked.
And another way to have it is to detach/attach physics actors when their physics are temporarily disabled. So check if actors are simulating physics before attaching/detaching them.

I had to fight a bit to activate the"auto weld" parameter in SM Component, as it was grayed out, but just setting the SM as Stationary then back to Movable made it clickable.
It was a bit better, yet still not perfect : in some configurations, the “ghost” effect still occured, but just grabbing the object back and forth with one hand then the other was enough to make it disappear at some point. Not user-friendly, but much more usable.

So I tried to investigate why “juggling” with the object would fix it, and I have to say I still don’t know, but at least I was able to create a function that “Make Root” of each snapped Actor, one Child after the other, and back to the original root. The original object is Detached at that moment, so I added a hacked Grab to force grabbing it again, and I can say it works pretty well.

Not sure what I can do more, as just changing the Scale of the object would make the bug occur (no detach/attach), so no other lead to investigate.
Maybe this kind of bug will be fixed when Chaos is used instead of PhysX…
However, thank you for your help, it was very much appreciated ! :slight_smile:

Edit : Oh, and I forgot to mention another parameter that was very helpful to squash the Bug.
In the Static Mesh Component -> Collision -> be sure to check “Multi Body Overlap” (expand by clicking the arrow if not visible).

Hey @, really appreciate the level of support you’re giving all of us!

I’m having an issue with Get Connected when trying to attach to a socket that is >= 2 units away from static mesh it’s part of. I can snap to the sockets, but I have code that checks if “Get Connected” returns anything and destroys the new component if there are no connections. The attached picture is an example of the static mesh I’m having issues with

It appears that UMSSRBPLibrary::MSSR_GetConnected at line 185 hardcodes the SearchDist to 2.0f. Is there a reason to not use the Snap Settings search distance? I’m guessing increasing this number will fix my specific issue, but I’m not sure if that’s a proper generic fix.

Thanks!

While increasing this hardcode did fix GetConnected to return something, it broke checking to see whether or not a socket was open if the actor was too small in some cases. As I anticipated, I’m guessing this algorithm would need a slight rewrite to get this working (or I’m missing some special way to get my use case to work)

I got something working (which is what I’m guessing your suggestion would be). I extended the collision of my Static Mesh to the extents I’d want to connect (i..e to the sockets). This worked was a no-code change solution

Hi SeesePlusPlus,
It’s 2cm because we’re searching the sockets that are exactly at the same location. We don’t need to look far away. But if the socket is outside of the mesh collision then it’s a problem, because we will not find anything. I usually suppose the sockets should be inside the collision. If it’s really needed to have sockets outside collision, then the solution would be to add an argument saying to override this value, for example we could use search distance from snap parameters.

Thanks for the quick response. I currently have no need for the sockets to need to be out of the collision, nor can I think of a scenario where I’d really want that. While I always love to have options, I’m happy with how it is for now!

There’s bug with Preview Actor in VR Example project (4.25)

I’ve just tried to use it with 4.25.4 and I don’t see anything wrong with the preview.
Can you please describe the bug in detail: how can I reproduce it, error messages, screenshots etc.

Thanks for quick support. I just updated 4.25.3 to 4.25.4 and all bugs disappeared magically.

Unfortunately I can’t take screenshots or video for you because bug is not existing anymore after update.
But when I had actor grabbed in VR, it showed preview actor stacked with grabbed actor and there was some weird lag with preview actor when moving motion controllers while actor grabbed…

However your plugin is awesome and I’m happy that I can continue development with 425.