I figured out some more of the math that would be involved, as shown:
I then considered how I could apply drag to the ball in a way to make the spline length approach a certain number. Thanks to the Math Stack Exchange site, I found this function I could use:
Unreal Engine has a "Linear Damping" functionality which reduces the velocity of an object on each tick of the game. I subtracted the function above from 1 to get how much to reduce the object's velocity by. This worked very well, but it still needs a lot of work.
I implemented this Resistance to Stretch, as shown below:
Additionally, I wrote out how I might figure out which direction to apply a force for Resistance to Bending dynamically. I figured out a way to figure out the direction by taking multiple partial derivatives of an ellipsoidal function. I made the assumption that two of the dimensions of the ellipsoid would be the same (the one along the ray-cast of the motion controller being the one that is different). Given the length of the spline as being the desired endpoint, I was able to calculate what the ellipsoid would be, and thus what direction to apply the force by taking the derivatives, by calculating the following:
My next step is to implement this as a force, combined with a drag similar to the Resistance to Stretching force, preferably in C++ if possible to avoid frame drops.
Time spent: Total: ~15 hours
- 2 hours - Working out math for Resistance to Stretching, Resistance to Bending, and Drag
- 8 hours - Implementing Stretching Force
- 2 hours - Platform size reduction
- 3 hours - GDD work
- Our gravity beam feels much better
- Almost all of the "difficult" things are programmed (even if they aren't working perfectly). AI is the last one to implement.
- Code for gravity beam is tightly coupled to the MotionControllerPawn
- Multiple branches in VCS, which doesn't work well with binary UE assets
- Whip mechanics still need a lot of work - feels like throwing a balloon with a pool noodle, when it should be thrown with much more force.