Sign in to follow this  
ThisPlay

Reflection

Recommended Posts

ThisPlay    122
Hi, I need to have the returning vector (or its incline) from a reflection when the entering vector E (dx, dy) and the incline of the platform P are given. My major problem is that I cannot use any Trigo. I heard that this can be done without it so... If anyone knows how to, I'll be more than just glad to hear it. :) ThanX, ThisPlay.

Share this post


Link to post
Share on other sites
ThisPlay    122
Do I need to normalize the vectors?
Does it matter if they're normalized?

And last... the normal vector... suppose I have the direction only, does it matter if it creates a triangle or that its values doesn't cross at all?

ThanX,
ThisPlay

Share this post


Link to post
Share on other sites
ThisPlay    122
Hi,

Ummm... it seems to work most of the times but not all of them...
Do you know why and how it can be fixed?

Just in case I did something wrong:

The RIn (I) vector points to the collision point.
The Normal (N) vector points to the collision point.

And...

T=Nx*Ix+Ny*Iy
Ox=2*Nx*T-Ix
Oy=2*Ny*T-Iy

Right?

ThanX (again... ;))
ThisPlay!

Share this post


Link to post
Share on other sites
Kambiz    758
Quote:

The RIn (I) vector points to the collision point.


The I vector should not point to the collision point... see the image. It should point away from the collision point.
try :
Ix = -1*Ix;
Iy = -1*Iy;

Quote:

The Normal (N) vector points to the collision point.


(just like I??)
How do you calculate N ?

Share this post


Link to post
Share on other sites
ThisPlay    122
Ummm... well...

The collision occurs with a ball and a player (both are circles).
So... I took the ball location where collided and the center of the player, which... makes the radius to the tangent and thus, the N.

It goes like this:
Nx=Px-Bx;
Ny=Py-By;

After that, I normalized N like this:
Nn=sqrt(Nx*Nx+Ny*Ny);
Nx/=Nn;
Ny/=Nn;

Is that right?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this