🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Help on Optimization Problem for Tennis Ball Physics + prediction

Started by
41 comments, last by kenBlade 5 years, 3 months ago

OK so you have downloaded and installed freeglut... Try an x86 release build. If that doesn't work, then try adding this following line to the main.cpp file:


#pragma comment(lib, "freeglut.lib")
Advertisement

I changed my settings in configuration manager from x64 to 32 and it worked. Not sure if that means I installed freeglut32 instead of 64 (website http://freeglut.sourceforge.net/ doesn't specify... i just used v.3.0).

However, the test scene only had a tennis court and camera system per your screenshot, but I wasn't able to launch any balls or see any collisions or flight paths. I assume this is still WIP?

 

Here's the settings I changed in VS2017:

  • 64-bit configuration - 64-bit Windows only
    • 64-bit Windows will compile and run a 32-bit project, but if you want to try to do 64-bit OpenGL projects, you only have to do a little extra work:
      • Go to Project->Properties
      • Click on Configuration Properties
      • Click Configuration Manager
      • Select New... from Active solution platform:
      • Select the new platform x64, and copy settings from Win32

 

Ps: Do I have to install GLEW as well? I did even though I have no idea what that is. I'm assuming no :)

OK, I'm going to delete that sln .zip file now that you have a working project. Try downloading the latest version of the source:

https://github.com/sjhalayka/tennis

The latest version detects collision with the net, and bounces the ball off of the net.

Yeah, I'm not sure why it fails for x64 builds... I'm stuck using the 32-bit version too (when on Windows, anyway).

It's very much a work in progress. I have to add keyboard controls, amongst many other things. Mouse picking would be a nice touch, but we'll see. Surely Unity has some kind of mouse picking code, to convert an eye ray's intersection with the tennis court? :)

And no, you shouldn't need GLEW. GLEW is for using OpenGL 2.0 or higher. The code I posted uses OpenGL 1.x, which is simpler for OpenGL novices to follow.

 

works brilliantly. I'll work on porting this to C# and working on the mouse pick feature.

 

How do you plan on implementing keyboard controls, btw? Hoping we can make a finished project collaboratively, if you're keen.

The keyboard controls are pretty simple to do in GLUT. See keyboard_func() in main.cpp in the repository. Please note that I upload new versions of the software on GitHub many times per day. :)

Once I'm finished coding in C++, I can sure try to help you convert the code to C#, if you still need help.

 

So what do you mean by making a finished project? Do you have animator(s) for your project?

I'm sorry, what is the purpose of your project? Are you making a tennis game?

I'm sending out a few serves, to see which two come closest to the specified point (black dot). Then from there I will alter their velocity vector length to get even closer to the specified point.court.thumb.png.ae33d14c2c3756d762814783f73769a6.png

Found the two serves closest to the black dot. Next, I will hone each serve so that it becomes closer and closer to the black dot, by adjusting the angular velocity vector length.

court.png

Yes I am making a tennis game. Had the prototypes with simple physics in an earlier link I sent. Also some videos of our WIP. Assume you might've missed those.

 

Any help converting to c# would be much much appreciated down the line.

Btw, I'm using Unity engine so it takes care of animations and other things like drag, gravity, and friction / physics materials. But can be replaced with your custom solution if those parts of your code prove to be more realistic.

 

And yes, Unity's mouse pick function should be relatively simple to implement...I just need to research it a bit.

Will check out your latest build later :)

I skimmed over the videos. The animation you use for the tennis player is amazing. Well, if you want me to work with your team, then ok.

This topic is closed to new replies.

Advertisement