The Forged Kingdoms OT: Dream Bigger

Viewing single post

Started by Legend, Sep 26, 2019, 08:18 PM

previous topic - next topic

Legend

I love when math simplifies.

One thing I think will be really cool is having companions physically toss you supplies when you need them. I just implemented the math for that and it becomes really elegant, even with wind.

Code: [Select]

float airTime = 1;
Vector3 throwVelocity = (targetPosition-currentPosition)/airTime;
throwVelocity -= (gravityVector+windVector) * (airTime * .5f);



It's fun seeing the ball thrown a bit too far only to be perfectly blown back into the catcher's mitt. Variations in wind will make it less perfect in the final game but that will just make the the thrower decrease the air time or walk the item over.