From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-04-2010 03:08 PM
First, calling your file xxx.jpg when it really is a bitmap is not a cool move. Add that to your lessons learned.
Without looking at your code, it sounds like a classic collision detection problem. Your object takes a large step and lands inside the boundary. You check, see a collision and reverse the velocity. In the next step it doesn't make it outside so you detect another collision and reverse the velocity again. Now you have effectively captured your object. One solution is to kick the object to the boundary along with reversing the velocity to fix the penetration problem.
01-05-2010 01:57 PM
Hello Darin.K, I think I did what you told me by multipling the velocity by -1 if the ball is near the line by using the case structure that I inserted but is still not working.
And how can I make the velocity constant?
Thank you for your time.
01-05-2010 07:28 PM
What is happening is that the circle is hitting the top or bottom of the line and you are reversing the x velocity but not the y velocity. You need a little more sophistication in your collision resolution.
You can make the velocity constant by replacing the 'Generate White Noise' vi with a constant. Just delete the VI, right click on the shift register and select 'Create Constant'. In the array just enter two values for x and y speed.
01-05-2010 08:06 PM
Echo Wolf2 wrote:And how can I make the velocity constant?
You can generate a constant velocity random xy-speed array by forming a complex number with R as the desired constant speed and rand(0..1)*2pi as theta. Typecasting it to a 1D DBL array will get you the speed array compatible with the rest of the existing code.
01-05-2010 08:20 PM
01-06-2010 05:08 AM
I tried seperating the coordinates of the "brick"but I am not able to fix the problem.
I think that I am either not entering the coordinates right and am unable to change the speed with that
or(which is my first choice) I am unable to to differentiate between the x and y velocities.
Please can you help me solve the problem.I believe that I made the velocity constant but neglected changing its direction when it hitts the upper part.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
01-06-2010 05:09 AM
01-06-2010 05:41 AM
01-06-2010 10:56 AM
You really digging yourself into a hole here. You are making these elaborate constructs to duplicate what the existing "in range&coerce" already does and then you are adding complicated stacked cases to repeat what the original simple FOR loop already does. You are actually breaking the code, because your new booleans are scalars and thus always apply to both x and y, blurring specificity.
All the small FOR loop does is invert zero, one, or both of the two speeds and that's all it needs to do. Your additional case structures don't change that. If you need to handle more specific conditions, manupulate the boolean array before entering the loop. All that extra garbage does NOT add functionality. Also, there is a primitive for a multiplication with -1, it's already there. No need for diagram constants.
At this point you should also make yourself familiar with basic debugging techiques: highlight execution, single stepping, probes, conditional probes, retain wire values, etc.. Then you simply watch what values appear and what they should be, and adjust the code accordingly.
(As I already mentioned, I would recommend that you try to solve it using an intensity graph instead. The code would be much simpler.)
01-06-2010 07:14 PM
Here is my alley way, brix, pong, bouncing ball. Attempt. I never finished it but i had started the most important part. the ball and paddle. I've dont this in C, pascal and Visual Basic. So when i tried to do the logic for the edges i just used c style code. The reason i did the degre out is so i could have the ball bounce at different angles. I never added the code for that. Maybe some of this will help? or make things worse 😉
p.s. snipet always does this to me? you may need to fix the broken wires, not sure why snipet does this.
p.p.s okay use the vi instead i guess 😞 it removed my pane:mouse movement from the event box? and the property nodes to the picture box? oh well.