Get matrix or rotation + position given 2 points

hi all!
I have this issue:
in the previous frame I’ve got a gameobject (with 2 points insid of it) that have p0World and p1World (both in world position.

after a particular movement, in the next frame I know the new p0World and p1World…
I need to move and rotate the game object to have the 2 points in the new position…

how can I do this?

thanks in advance

I don’t even know what this means. You mean sub-GameObjects? You mean Vector3 fields inside a MonoBehavior script? GameObjects can’t have “points inside of it”.

I try to explain: the gameobject is located in 0, 5, 4 world position, it has 2 Vector3 properties like

  • p1 = 0, -0.1, 0
  • p2 = 0, 0.1, 0

these in my script are 'offsets referred to the gameobject:

in frame 0: the gameobject is in 0, 5, 4 rotation 0, 0, 0
p1(world) = 0, 4.9, 4
p2(world) = 0, 5.1, 4

in frame1: the gameobject is moved in 1, 6, 3 rotation 0, 0, 0,
p1(world) = 1, 5.9, 3
p2(world) = 1, 6.1, 3

but if in frame2: the gameobject is moved in 2, 5, 2 and rotation of 10, 5, 0
p1(world) = ???
p2(world) = ???

hope this example let you understand my issue

thank you!

Can you just make 2 empty GameObjects as children of that GameObject, then store the positions in their transform.position? That way when you move or rotate the parent GameObject, the other two will automatically be correct all the time, in real time.