News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Help with reflectance angles???

Started by ScottieB, January 21, 2013, 07:05:44 AM

Previous topic - Next topic

ScottieB



Say I want to move circles around with this...

x_vel# = X_Vel# + Cos(Angle) * (Speed * ElapsedTime#)
Y_Vel# = Y_Vel# + Sin(Angle) * (Speed * ElapsedTime#)

X_Pos# = X_Pos# + X_Vel# * ElapsedTime#
Y_Pos# = Y_Pos# + Y_Vel# * ElapsedTime#

and I hit walls top,bottom,right,left  screen
and I hit other circles on the screen

How do I figure out how to change the angles of reflection???
I'm having a real hard time at this I've tried lots of ways but nothing is sufficient to my likeing.

I know it's usefully the angle between the surface normal and the incident ray to get the degrees it must be added or subtracted but
I can not write this into easy terms to understand.  I think i'm making this harder than it is.
Can someone please help me wrap my head around this as I need this for part of a program I'm writing.
Thanks
peace
out

ATLUS


Sigtrygg

Hello Atlus!

Can't believe how short the code for the orbit simulation is...  :)

kevin


Here's a very old  example.  Calc Ray Reflections (login required)