• News

• Industries

• Learning & Support

• Community

• Marketplace # Calculating a transform based on reference points

Hi all,

See image below. I have 3 separate reference points (A1, A2 and A3 in red) which could be anywhere in the world (but locations are known). The blue triangular object is a single actor, its origin is on Ref1. The question I have is this: how can I calculate a transform that rotates/scales the blue triangle so that the location of Ref1 = A1, Ref2 = A2 and Ref3 = A3?

I have been looking at vector math matrices etc (without having much understanding of it, I’ll admit) and I do have a (non UE) script that achieves this by doing a series of rotations and scalings, but the difference with UE is that it recalculates the coordinates of Ref1/Ref2/Ref3 in each step, which I can’t use as input for a Transform. There must be a series of blueprint nodes that achieves what I need but I’m getting all stuck with it - not so good with maths, either.

Hope someone can point me in the right direction… Thats tricky , but can be done!,

The scale,
Get the distance between Ref1,Ref2 , This will be BLUE_Dist 3.5
Get the distance between A1, A2, this will be RED_Distence 7
RED_dist / Blue_dis = The scale you need to apply to blue to be large like the red
The Rotation
I think it depend on the real shape of the triangles you have, They are perfectly the same?
the blue is oriented ? is a Right_angle? is Isosceles ? is a random triangle?
By the way
Using the MakeRotatorFromAxes, you can create the rotation from directions
https://docs.unrealengine.com/en-US/BlueprintAPI/Math/Rotator/MakeRotationfromAxes/index.html
Otherwise you can use
Find Look at rotation, to set the first rotation so that X i thinkhttps://youtube.com/watch?v=zsPG_4vrbYIthan you have to calculate the rotation of the last axis.
is a bit of work of Vectors.

Thanks for your help so far - I’ll look into it. The assumption that the triangles are equal in shape is correct. They just have a different location, scale and rotation.