Any way to get world pos from components local+some kind of offset
Hello. I have the scenario where i have a component that is supposed to spawn actors in a 'grid-like' manner. The problem is I don't know how make that it uses the component local position/rotation as an offset to spawn then with offset.
I mean if the component is rotated his local Z vector will point in a different direction. So i want to use that Z vector to spawn along the actor with '50' units offset from one another, and go along X or Y for row offset. And SpawnActor ( ) uses world coordinates ;/ So I am looking for a way to turn the local coordinates + offset to world coordinates.
My first several attempts I used to - but only works for aligning everything horizontal and in one direction, and i give the piece/segment rotation manually.
FVector location = GetComponentLocation( ) + FVector( -50 row , -50 line , 0 ); APipeSegmentC * segment = World->SpawnActor( m_BlueprintTemplate , location , m_PieceRotation ) ;
So with help of a collegue who is better at math then me we solved the problem - so here is how it goes FVector location = GetComponentLocation( ) + GetRightVector( ) line ( -50 ) + GetUpVector( ) row ( 50 ); - by using Right and Up vector and the offset of 50;
answered Nov 05 '15 at 02:13 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here