I have a small problem. But i cant figure it out.
What i want to create is a ball moving around a world, (Like just a room)
And i want it to bounce correct on all
I have the ball’s possition and direction, and offcourse the Normal of the triangle the Ball collided with.
How can i invert/change the Ball’s Direction? Is it possible to just muliply it with the plan normal?
You have to calculate the reflection vector.
r = reflection vector
n = plane normal
v = velocity vector
- = scalar/vector multiplication
dot = dot product
r = 2 * n * (n dot v) - v
But what is Velocity?
Direction? Direction - possition?
The velocity vector is the direction in which the ball is moving. A more proper word could have been direction, instead of velocity vector.
vNormal = [0, 1, 0] Floor
vDirection: [0, -1, -1] // Sphear is moving down/into the screen.
When hiting the floor, i use:
vReflection = vNormal * Dot(vNormal, vDirection) - vDirection;
Then the reflection should be [0, 1, -1] right?
But its [0, 0, 1] any idea why? What am i doing wrong?
See my code again, you forgot to multiply by 2.
Also remember that I can’t guarantee that formula is correct. I came up with it in a minute from a piece of paper and a pencil
Then the reflection just becomes [0, 0, 2]
Ill stop flooding you with dumb questions, and try to get my hand on some source code
Remember that this is an OpenGL advanced forum?
Then, why are you asking non OpenGL questions?
There are many places for your questions, for example
Please, don’t fill this forum of offtopic noise.