Tag Info

New answers tagged

4

Let me try to give you something somewhere between The Light Spark's answer and Elliot's answer, because from what I read, you're really looking for an algorithm to follow and not just math tossed at you. Problem Statement: Given that you have a location A (50, 50) and a heading (since you didn't provide one, I'll assert it as y = 2 * x + 25), find where B ...


5

I've done this with trigonometry rather than matrixes in the past (I am a matrix noob). Ashes999's answer is halfway there, get the relative vector, then rotate that by the inverse of EntityA's angle. relativeX = B.x - A.x relativeY = B.y - A.y rotatedX = Cos(-Angle) * relativeX - Sin(-Angle) * relativeY rotatedY = Cos(-Angle) * relativeY + ...


11

Okay, so Assuming that you know what the World Transformation matrix for that object A is, You just need to construct the inverse of that matrix and you will have what you need. Suppose the rotation, scaling and translation matrices of object A used to get it to Global Space are R, S and T respectively. You will multiply these together like S * R * T = W ...


-1

To put it simply entity B would need a reference to entity A. You'd then need to get the difference between entity's A position and entity B's position.



Top 50 recent answers are included