Monday, October 17, 2016

Andrew DiNunzio - Oct. 4 - Oct. 11

This week, I spent more time working on the ball's interaction with the gravity orbs.

In an effort to make the ball hook more, I changed the way the sphere works a bit.

First, instead of multiplying the force from gravity by its dot product with its x-velocity, I instead applied a function to it, so it would not be a linear change from a dot product of 0 to a dot product of 1. I wanted it to be a concave down function, as shown on the right of the following picture:



The function I chose was f(x) = -(x-1)^2 + 1, looking at it in the domain and range of [0,1].
This did help increase the hook of the ball, but not enough. Since the second half of the orb didn't apply any force to the ball, I wanted to make further changes that I thought could improve the hook from the gravity orbs. With no force on the second half of the orbs, throws that should have had a significant amount of hook on them simply straightened out towards the opponent's wall.

So instead of removing the force on the second half of the sphere, I instead made it so that the x-component of the force applied to the ball would be ignored on the second half of the sphere. This resulted in the additional hook that I wanted, but created another problem.



It made it so that if the ball is moving too slowly, it could orbit (around the line along the x axis, going through the center of the sphere) on the yz plane. This looked really bad, so I changed it a bit again.

Working with Mike for this, we made it so that any force in the y-axis or z-axis (only on the second half of the sphere) would not be applied if the direction is opposite the ball's velocity (i.e. the dot product is less than 0).

It worked pretty well, giving me the hook I was looking for in some cases without oscillating. However, there was still an issue. If the ball traveled through the gravity orb (say, on the right side of the orb looking to hook around it to launch to the left), if the ball's velocity was still headed more in the right direction, instead of the left direction, when passing through the first half of the sphere, it loses its hook entirely.


We decided it's okay to leave it this way for now, since we do not want to do too many premature optimizations when the rest of the core functionality remains to be done. It is something that will still need a lot of work though.


Random thing we learned:
We also learned that scaling our orbs in the Viewport messes up the ball's collision (due to the way the orb's construction happens), and we have to scale the orbs using its Blueprint property (that I created) called InnerRadius instead.


Time spent: Total: ~7.5 hours
  • ~1.5 hours - Changing the dot product function to be more quadratic than linear, allowing for more hook.
  • 3 hours - Remove x component of force applied to ball when in second half of sphere, but still apply the other force components
  • 3 hours - Fix the oscillating issue of the ball by removing forces in yz plane if going against the ball's velocity (NEEDS WORK).

Pros:
  • I'm learning what kinds of things I need to take into consideration with these gravity orbs. In the end, they may as well not even be called gravity orbs since the mechanism behind it is going to be significantly different from that of actual gravity.

Cons:
  • We still don't have a satisfactory mechanism for applying force from the gravity orbs.

No comments:

Post a Comment