Peggle Prediction and mAtan
by Drew Robson · in Torque Game Builder · 07/30/2008 (4:15 am) · 1 replies
I'm writing a ball trajectory prediction path similar to peggle, and ran into a couple of issues. Firstly, does anyone have a formula/code sample for launching the ball on a path that intersects with the mouse, where the ball is under the effect of ConstantForceY gravity? My current solution predicts the curve correctly but it uses the angle from the mouse, which means the actual path drops below the mouse point.
Secondly, I have this sample which claims to do just that developer.popcap.com/forums/showthread.php?t=3976&page=2 except I'm having issues with mAtan. In the sample, it takes 1 value, a result from the quadratic. I'm used to atan taking 1 value also, and the documentation shows mAtan takes %val. In reality it takes 2 values. When I plug in the plus-or-minus values from the quadratic, it gives odd results, not the required launch angle as expected.
Also, TGB's angle & co-ordinate system make this exercise a little more 'interesting'. Thanks to anyone who can shed light on the above.
Secondly, I have this sample which claims to do just that developer.popcap.com/forums/showthread.php?t=3976&page=2 except I'm having issues with mAtan. In the sample, it takes 1 value, a result from the quadratic. I'm used to atan taking 1 value also, and the documentation shows mAtan takes %val. In reality it takes 2 values. When I plug in the plus-or-minus values from the quadratic, it gives odd results, not the required launch angle as expected.
Also, TGB's angle & co-ordinate system make this exercise a little more 'interesting'. Thanks to anyone who can shed light on the above.
Torque 3D Owner Dan Keller
Default Studio Name