I was wondering if anyone could give me pseudo-code that can help me to create the trajectory for throwing grenades for a first person shooter; I do know how to make things "explode" but, I don't even know where to start when it comes to mechanic. I want the player to be able to throw the grenade towards an enemy( and visa versa) but, I don't want it to move straight like it's a rocket or bullet. Instead, I want it to have a trajectory similar to grenades in half-life. Any suggestions?
So you just use physics equations to make an arc.
https://openstax.org/books/university-physics-volume-1/pages/4-3-projectile-motion
Rosenzweig
Wow. Learning physics is hard. π
I've decide to search for an alternative to solution and I came across this tutorial series.
It's incredibly close to what I want but, after watching the entire series, I do predict that will cause problems. I could use some of the ideas I've learnt from the tutorial to fire the grenade with realistic physics and I could even have the player determine the general direction of where the grenade will be thrown. However, I don't think this tutorial will help me to make a player's character( the FPS Controller) accurately predict what's the best angle to throw the grenade at a visible target. I think the series consist of hints to figure it out. I'll try to adapt what I've learnt from this series, integrate it into my project and then get back to you if my suspicions are correct.
It's pretty simple high school math, to be honest. Maybe this video will make more sense.
Rosenzweig buddy you gotta remember some of us dropped out.
it's not hopeless for us though. my years in game design is 100% the reason why my second attempt at a passing grade in algebra is infinitely easier. so far.
Here is a great resource for some deterministic ballistic projectile calculation for game development:
https://www.forrestthewoods.com/blog/solving_ballistic_trajectories/
... there is source code linked in the conclusion section. The source is c# but it isn't hard to convert to gdscript since its only math.
Koslo I technically graduated but, I only had enough subjects to go to art college instead. π
Rosenzweig Yeah. I had to go and look up non-university sources for more clarity. What I grasp so far is that the horizontal movement isn't affected by the vertical movement. There is still some stuff I'm not grasping but the other sources made it easier to return to the university chapter. π
© 2022 - 2024 β McMap. All rights reserved.