How do I work out one object's relative position to another?
I'm pretty sure you can do something like... multiply one object's coordinate space by the other, and then see what it's position is... but I can't quite remember or seem to work out what to google let alone the best blueprint nodes to use!! How would I work out a characters relative position to a cube in the level for example? To elaborate, in the following picture (sorry about the quality....) I want to find the players (P's) RELATIVE y offset. RELATIVE to the cube's own coordinate system and rotation. I can't do it in world space because no matter what orientation I place the box I want to get left and right across it as a y value.
(comments are locked)

I found this solution to my problem. In this graph I'm getting the location of the actor (1.) relative to the position of 2. I would still like a more flexible solution involving two transforms.
(comments are locked)

Hey there im not quite sure if i get you right but could it be that you are looking for Get Actor Location, which gets you the LocationVector of your desired object? If you mean with relative Position between Character and cube the vector between them you could substract bot actor location and its returning the vector. F.e. From Cube(Point A) to Character(Point B) you could substract BA and you get the direction vector (DirV). The relative positionnow would be: PointA + DirV = PointB Was that you intention? kind regards Wallhalla
(comments are locked)

oh sorry i mixed the overlay behaviour. Actually if you spawn something into the world this will alter the modelview, so if you spawn the next it takes the altered modelviewmatrix as base. I assume to work correctly inside the editor, each time an object is put into the world there is an overlay of the worldmatrix (PushMatrix) and after that there is a (PopMatrix) this results that every drawn object is relative to the worldcoordinate space. To be honest i really would like to know how epic does this magic for real, because i dont know if im right with this. However i dont think set up a new coord space is not the right thing to do here ;) best regards
(comments are locked)

ill try it with that, and sorry i cant test that right now "To elaborate, in the following picture (sorry about the quality....) I want to find the players (P's) RELATIVE y offset. RELATIVE to the cube's own coordinate system and rotation. I can't do it in world space because no matter what orientation I place the box I want to get left and right across it as a y value. " Inside the Player you get a reference to your cube, i think like you did in the picture before. Call GetActorLocation from Cube (Vector 1) Call GetActorLocation of your PlayerActor (Vector 2) Then substract them. Vector2  Vector 1 > and you will get a Vector which has the direction Cube to Player That means break down to the y value of that vector you would have the amount of y units you need to go to get to the player´s yorigin position (the mentioned offset) Otherwise substracting Vector 1  Vector2 and break down the result to y component you will get the y value of how many y units you need to go to be at cube´s yorigin position maybe that helps :) that still sounds like you are in world space with that solution, not in the local coordinate space of the box, like the question wanted. you used 2 positions as inputs, without using the rotation of the box at all. so you didn't use enough information to transform into the box's local coordinate space. before you can subtract those vectors, you need to rotate the players position around the box, with an equal and opposite, "inverse rotation" of the box. im sure there is a way to do it from scratch, using nothing more than a mess of "sin(yaw) * cos(roll) " nodes, but without blueprints supporting matrices, you might want to do this in c++. another way to state the problem from the box's view, is: you want to rotate the players position around the box, with an opposite rotation than the box, then subtract the vectors to find the distance and take its Y component as your answer. to do that rotation, usually you multiply by the inverse of a rotation matrix for each axis of rotation, in the same order the engine uses to rotate the cube. if you don't use the same order, gimbal lock can throw the cube's rotation and the resulting data out of sync. a hacky solution might be to have an invisible actor that you move to your player and parent to your cube, then you find its relative location to its parent, and take the Y component as your answer. to constantly update this, you would have to (unparent, move, parent, test) for every update, but if you only need this info rarely, than this hack might work. imagine trying to do this kind of math in blueprint, with nothing but basic trigonometry nodes: https://www.youtube.com/watch?v=HQYsFshbkYw
(comments are locked)

Follow this question
Once you sign in you will be able to subscribe for any updates here
Hey, i see this question is still open. Is your problem solved? Did my answers help you out? Or do you still have some problems with this?
best regards