vector mirroring or bouncing?
Blitz3D Forums/Blitz3D Programming/vector mirroring or bouncing?
| ||
Hey guys, I tried bringing this up in the Blitz Max forum and didn't really get the answers I was looking for. I'm coding in b3d for this anyway so I should have came here first. I just figured there would be more people on that forum. The game I'm making is strictly 2d, so I can't use any of the 3d functions. Do you guys know how to reflect a vector relative to another opposing vector? I have a vector for the normal of a wall and I have the vector for direction of the item that will hit it. How do I calculate the refected, or richetted vector? |
| ||
Function mirror(vx#,vy#,nx#,ny#) dot# = vx * nx + vy * ny target\x = vx-2.0 * nx * dot target\y = vy-2.0 * ny * dot End Function |