Hi to all, I am working on a project where I want to snap actors at a certain location of another static actor. The first actor has to be placed on the static actor. When the actor is placed, you can place another actor of the same kind (or another of the series) and they have to snap at eachother.
So I made a test actor Blok-1 BP, with 2 snapping points ( Snap Origin and Snap Point.) So the static actor where the movable actors have to be snapped on, had an “socket” cube, SnapDorpel.
What I try to achieve is, that the BP of each Blok BP’s is checking overlap with the static actors snappoint and the set off physics and snap to that socket location. If there is already 1 actor on the static-actor snapped, you must be able to snap above another Blok-1 with the SnapOrigin to the snappoint of the actor which was already placed.
My BP in the actor so far:
I can’t get it working. The overlap detection isn’t working at blok on blok, so the rest of the nodes didn’t also work. And I don’t really know if I have to snap actor to actor or snap actor to component? The snapping of the Blok actor to the static actor is kind of working, but snaps at a certain point and not directly on the box overlap.
And what about the Rule’s (location ,rotation etc.)?
What I ideally want is that the overlapbox snaps exactly to the box at the actor, so the position and rotation is correct.
Hope somebody can help me out with my issue?
Thanks in advance!
I can’t say exactly what problems are down the road ( not a physics buff ), but to get the initial concept working, you need to have collision boxes over the elements that can snap together.
The way, when one cube overlaps another, you have two actors to work with, and can do the alignment and attachment.
I have the boxes set as triggers. But I think there is some node-stuff wrong maybe in my BP?
I have the overlapping and snapping working, as far as it goes to the Snap Origin. That mesh snaps perfectly to the cube in the other actor, but the Blok-1 static mesh and the other cube Snap Point are disconnected then from the Snap Origin.
What I want is that it stays together at this location, untill I grab the actor again and physics become available again.
My BP till now:
Maybe there is something wrong in the parenting of the static meshes?
How can I attach a component of an actor while the other stuff in it goes to the same location/rotations?
Thanks in advance!
I have tried many things, but can’t get this working…
Anybody an idea how to solve this?
I’m a little confused what your code is doing , but that’s not hard to be fair!
Any way, surely on your begin overlap you would cast “Other Actor” to the type you are expecting, if it fails Do nothing or something else, if it works then run your code to attach? Forgive me if I’m wrong.
If the socket is parented to the root of the Blueprint Actor you can use AttachActorToActor , other wise you need to AttachActorToComponent.
But I would disconnect the Event from the code and just fire off a Print Text only for the ActorBeginOverlap and make sure you are getting a hit first. (quick and dirty way to test!)
Then work pragmatically through your code bit by bit.
Hope this is of some help!
Hi Stewart, thanks for the reply!
I will give it a try this afternoon. One question I am not sure about: when I use attachActor to Component, I want the socket I placed in the actor to be positioned on a component cube of the actor where I want to attach to. So how do I the positioning and rotation correctly? Is there a possibilty to attach one socket of an acgtor to antoher actors socket? I couldn’t find a solution on the internet…
no problem @Mikeymore
Do you need sockets on the attaching actor? if you attach the actor to the parent actors socket and it should orient how you have set it, thought there are overrides for that when you call the attachactor. you could always query the parent and get the location of the component then add any offsets you require to nudge it into the right place.
As far as the socket on the child you are attaching, place it in the blueprint at the point you wish the attach to, does that make sense? as you attach to the centre of the socket. but i would use the sockets on the parent which gives you full control by placing them where you want your child to connect.
Let me know how you get on
I think i also need a socket on the actor I will attach to the static parent. My case is so: I have a wall with a socket and an actor I can grab and place on that wall, but only at the socket position of that wall. When I grab a second actor (same as I already attached, I will place it attached to the actor that’s already placed, also only at a certain position and rotation. Think of it as panels you screw above eachother against a wall…
ok so wall needs a socket, each attachment needs to be able to attach to that socket, and have its own socket for attaching another actor. so the actors need 1 socket only where a child actor can be placed, so you attach the first actor to wall socket, second actor can attach to the socket on the first and so on.
AFAIK you dont need a socket to connect to a socket, so aettch actor direct to socket each time, then each actor just needs a socket for any child actors
Yes exactly how it suppose to be!
Later this day I will give it atry and see or I can get it working…
Hi Stewart, I have tried some time to fix it, but it isn’t working…
Overlap is working, print string is showing up. I placed a grabcube from the standard vr template and it snaps with the same BP nodes perfectly to the socket.
I have a panel thick 1mm and about 3m length and 1 m high. It’s a profiled piece. I tried also with a flat cube, works a bit better but doesn’t snap the right way. It snaps to the wall when intersecting a bit of the corner of the plate sheet. It is also positioning in a weird way… Sometimes when it snapped to the static wall I see the sheet flickering.
What I also tried before was snap component to component and snap the SnapOrigin cube. That works well, and snaps in the right location/rotation, but because it’s a child of the BP the blok mesh doesn’t come with it. So I think that’s not the way to go?
I also tried attach actor to actor/actor to component.
I am a bit stucked right now.
Maybe you have a good suggestion?
Is there anyway you can show me a short video of whats going on, and explain what should happen. If not some images maybe?
What you want sounds very simple, maybe your collision spheres are overlapping and are too big?
Its hard to tell without seeing it, would love to help more if i can visualise it.
Let me know!
Hi, thanks for the reply!
Here some screenshots of the level:
This is the level as it is build. Static wall with socket (cube) where I want to attach the panel.
The actions I want: overlap green cube with the white (socket) cube → attach the sheet horizontally to the wall. No rotation in any axis.
Cubes are triggers. Socket is in the centre of the white (wall) cube:
What is happening, is that the sheet doesn’t snap and align to the white socket cube, but randomly on the wall meshes. Even if the green-white cubes aren’t overlapping, there is still an attach to the wall.
Sheet has grabcomponent and physics enabled.
Some of the BP’s:
BP of the wall:
By the way, the socket is set into the white cube in the static mesh of this cube.
Hope it’s a bit more clear now to you?
ok that helps alot, let me try this out my end see if i can make something work, how are you moving the actor to test the collision btw?
In VR with controllers I hover the sheet actor over the trigger cube with socket.