#Mirroring a 2d point on from another 2d point.
1 messages · Page 1 of 1 (latest)
I tried using the angle between the two and the distance, but i cant seem to make it work...
Reflects a vector off the vector defined by a normal.
That's exactly how to use it. The normal is like the surface of whatever you're reflecting off of
So if it's a table top the normal is up
so like 90 degrees to both of the points?
No. It's going to be coplanar, but that's beside the point
so how do i define it?
Like I said, the normal is like the direction the surface is pointing. Like a mirror
Thinking about this though you might need to do this in local space
Well, you want a mirror a vector across another point right?
yes
You need to find out what axis you want it mirrored across
i got the angle between the two points?
No, you don't need that
Imagine putting up a mirror so the reflection of the point appears where you want it
It'll be exactly in the middle right?
The direction the surface of the mirror is pointing is the normal
ok, but how is it defined?
It's a Vector2
Sorry, can't do that rn
ok
But it depends on what you want to do with it
ok ill show you
Vector2.Up or Vector2.Right are both valid
But collisions also give you normals you could use to bounce like a laser
Ok I think I misunderstood
Do you know how to get the direction from the ghost to the point?
vector2.angle?
No
It's endPosition - startPosition
It'll give you a new Vector2
Add the result of that to the position in between
We're trying to find c
yes
In this case endPosition is the mid point
so, endPosition + (endPosition - startPosition )?
For this yes. endPosition - startPosition is a common formula though, so it's good to remember