I am crating this project for my company in which I need to create a simulator type thing where a gizmo is used to move few hard surface modular objects around. The objects are kind of like lego pieces and now I need to create a snapping system for the same. I am passing gizmo transform in order to move the objects around. I am also using the sweep feature on the objects in order for it to collide properly. What I am stuck at is how do I proceed about making the snapping system? Should I make a new blueprint component for it or what? What should be the logic? What I was thinking was that maybe I should create a new blueprint component for collision volume and on overlap event I should snap the pivots. Is this approach right? Perhaps any guide or insight on this would be very helpful for me
What I was thinking was that maybe I should create a new blueprint component for collision volume and on overlap event I should snap the pivots. Is this approach right? Perhaps any guide or insight on this would be very helpful for me
Not sure of how much use it is but I was toying with something somewhat similar here:
The project is attached and I believe (can’t recall, honestly) it does revolve around a specialised component serving as an anchor point, which can then be added to actors. From there on it could be a matter of attaching component to another component.
In short: I don’t see why the behaviour you envisioned wouldn’t work. So I’d definitely try that first.
Okay so I gave it a shot and what I couldn’t figure out is how should I approach it? I have multiple objects that I need to snap with one another, so, should I create a master blueprint with the collision component that’ll enable the snap and then inherit all the object from this class and cast to it on overlap in order to get it working? Is that how I should approach this?
Encapsulate logic inside - what happens when a SMC pin overlaps another SMC pin.
You could then add those SMC pins to any actor. There may be many pin classes, each hosting different rules of attachment; inheritance would be a must if elaborate level of complexity is needed.
Based upon what you suggested, I was able to create something. However, now how do I filter which object to move? I have created a gizmo and I am passing the gizmo transform directly to the actor I want to move.
This is what I have so far for the SMC, however the logic fires for both the objects that it is attached to. I am trying to attach a side component with a center piece. The SMC is attached to both the objects. How do make it so that only the moving component snaps? How do I filter what component to move?
Assuming there’s a bunch of immobile pieces on the board and we’re moving one that is supposed to snap to something else and then pivot in place, I would equip the owning actor with a boolean flag isMoving - set True as soon as it’s being dragged around or interacted with.
When interaction happens, this flag can be used to determine which actor is being operated on and whether the pins it owns can fire the script.