# How do I use Rotate Vectors Correctly to snap objects together ? Help!

I’m trying to snap cubes together on any axis. I’m having trouble using the Rotate Vectors node. It doesn’t seem to be rotation correctly based on the rotation I give it.
Can someone please take a look at my project, and tell me what I’m doing wrong? (attached is my unreal test project)

Is there a better way of snapping than what I am doing?

Thanks

Can you give a pic of what you’re trying to do?

Right now, I’m suspecting two things:

1. You’re not using world location ( I see relative, but relative to what? )

2. You may be making assumptions about the pivot point on the cube. Some cubes have a central pivot, others have it in the corner…

I did a walk-through of the problem and my bp here: Unreal Attachment & Snapping Version 3- Still working on Snapping to Snappoint. - YouTube
You can see that it works fine for awhile…and then something happens… and then…well…it breaks.
My current guess is that its the Physics Simulation destroying the rotations…but that doesn’t make sense.
 I turned off Physics Simulation and Collision, and I get the same result. It works for a while, then stops.

1. It’s relative to it’s parent. It becomes a child when attached. I can try using World-Space, but I think it will be the same. I will try it though just to cross it off.

2)I built it so that the pivot can be in any location. As you will see in the YT video, I have the pivot at the base, and in the center.

Ok, watched you vid. No it’s not physics, is it… It is something related to world / local / relative etc but I can’t see what yet… will ponder it a bit…

Hmmm… Something I notice looking at your code is that, possibly, you’re introducing an error using that distance from origin node ( distance from 0, 0, 0 ). Because as you’re making the calculations, the cube is still moving. This kind of thing could also be happening elsewhere…

It’s just a hunch, as you have obviously thought about this a lot more than me.

Myself, I never use the attach actors construct, so don’t know it’s up/down sides.

Sorry, coming up with nothing here. I can see it’s time related, the longer you move the cubes around, the worse the problem gets. Take a look at your code, what is increasing as time goes on?..

Nothing! LOL… That’s why I’m so confused. Tonight I’m going to rework the math. Something is wrong in my numbers… has to be. Need to check it one axis at a time.

Thanks for the brain-storming… helps alot!

Bro… Like you said… I wasn’t using WorldLocation. After I tore it down…TWICE… I realized if I used WorldLocation, I wouldn’t need to worry about calculating the rotations. These 8 nodes replace the 30 odd nodes I had… LOL

Excellent!, at least I kick-started a different approach…