Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golf Simulation #22

Open
Cheeseness opened this issue Feb 12, 2014 · 17 comments
Open

Golf Simulation #22

Cheeseness opened this issue Feb 12, 2014 · 17 comments

Comments

@Cheeseness
Copy link
Contributor

The titular aspect of the game (golf, not bad) has been highlighted as important by Patrick. His suggestions are to aim for a simplified, predictable golf simulation similar to Mario Golf on the Nintendo 64.

  • Ball ballistics/collision physics
  • Driver swing mechanic
  • Putt swing mechanic
  • Aiming controls (rotate around the ball)
  • Club variations? (multiply power based on club type?)
@Vaakapallo
Copy link
Contributor

I'll start testing some very simple ways to move a ball around.

First step is being able to hop the ball forwards when close to it. I'm not sure I can pull off all the things listed here, so anyone is free to play around with this as well.

@Cheeseness
Copy link
Contributor Author

Great! :D

@The-Mad-Pirate
Copy link

A very important aspect of golf physics is related to the golf ball's surface , you know that little dimples the ball has, At high speed Navier-Stokes equations ( http://en.wikipedia.org/wiki/Navier%E2%80%93Stokes_equations ) indicate there should be small turbullence vortex forming around that dimples ( http://www.sigmarockets.com/blog/wp-content/uploads/2011/06/golf_ball_drag.1.jpg ) in a way mixed turbulence works as a separation layer between the golf ball and the more stable laminar flow. This is done for various reasons , 1 ) it makes drag harder to decrease a ball's speed and 2) turbulence air flow creates a higher pressure difference , making a golf ball more likely to stay longer on fly.

@Cheeseness
Copy link
Contributor Author

We're not aiming for a hugely realistic sim. An approximation that's solid, predictable and fun is enough :)

@The-Mad-Pirate
Copy link

A think an issue with physics simulation is wind conditions ( mostly direction and speed ) , since a particle simulation is out of the question ( too espensive for a realtime simulation).

@Cheeseness
Copy link
Contributor Author

I think that wind simulation would start to move us too far towards realism. We're aiming for something that's too fast paced for dynamics like wind to be anything other than cumbersome.

@The-Mad-Pirate
Copy link

LOL! I know , it's just the physiscist in me who gets excited.

@Vaakapallo
Copy link
Contributor

Okay, you can now rotate around a ball, determine the hitting force by pressing up. Then send the ball flying with Space. It flies straight forward in an arc. the force determines the distance and height of the arc.

There's a really ugly Gui Box showing you the power of the swing.

That's not all though. When you do that, you warp back to your cart and you can drive around while the ball flies. Then by hitting "E" you can go back to swinging mode and hit it again. Then you are back to the cart etc.

@Vaakapallo
Copy link
Contributor

Now you can only change to ball swinging mode when you are close enough to the ball. There's an ugly GUI box to tell you when that is.

@Cheeseness
Copy link
Contributor Author

Awesome! I'm looking forward to testing this out :D

@pdxaaron
Copy link

Vaakapallo, this is awesome. I've been working on this, but was trying to use a raycast to determine where the ball was struck to apply torque as well... Everything I try in unity seems easy, but I end up down this crazy rabbithole of a learning curve, and by the time I have something functional, it's been done bigger and better already...

Anyhow, would you mind if I ran with this test and tried changing the swing mechanic a bit?

My thought was have the character model stationary to the left of the ball, rotation left and right around the ball's axis when aiming, then on mouse down, you would build up the force from pulling the mouse down, then adding to the force and also creating torque to the ball when pushing the mouse forward.

I think it would allow for a fast swing which is what we are looking for instead of the 3 click golf swing.

@Vaakapallo
Copy link
Contributor

I wouldn't mind at all. That sounds great.

@Cheeseness
Copy link
Contributor Author

then on mouse down, you would build up the force from pulling the mouse down, then adding to the force and also creating torque to the ball when pushing the mouse forward.

This is similar to how we do things in Neverputt, although we don't model torque (and moving the mouse forward has no impact).

I'm interested to see what you come up with :D

@Cheeseness
Copy link
Contributor Author

@pdxaaron, @Vaakapallo Were you able to make any forward progress on this front?

@Vaakapallo
Copy link
Contributor

Nope, no yet, I ended up integrating this to the driving sim #78 . Though that should be compatible with completely changing the way the golfing mode works.

@The-Mad-Pirate
Copy link

Regardin golf ball "Out Of World" issue , my suggestion is :

  • there might be a way to avoid the ball issue by using non renderable copy of terrain geometry and use it as a ball collision detection so if the ball collides with this underground geometry is simply move up back again you might avoid performance penalties by using occlusion culling though
  • another less expensive solution would be to enclose all the terrain only geometry inside a box collider and respawn the ball accordingly then.

@Cheeseness
Copy link
Contributor Author

@olldray has suggested that the current issue with the ball sometimes falling through the terrain may be the result of the ball being parented to the buggy (re-parenting the ball to the scene apparently resolves the issue) and that Unity is constantly working out the relative movement between cart and ball, and cart movement across terrain causes the ball to jiggle through the terrain. This is consistent with the symptoms we've seen.

I think we should look at what options are available to us once we get the currently outstanding networking branches merged back in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants