Python: Calculate Physical Bullet Hitpoint / Needed Force

Hi,
Find the hitpoint of a physical bullet shot.
UPBGE03_hitpoint.blend (915.1 KB)

(UPBGE 0.3)


#Controls
#A/D            left/right  
#A/S            up/down
#Mousewheel     Force
#Space          shoot

#docs:
# https://physics.stackexchange.com/questions/27992/solving-for-initial-velocity-required-to-launch-a-projectile-to-a-given-destinat?rq=1
# https://forum.unity.com/threads/how-to-calculate-force-needed-to-jump-towards-target-point.372288/
2 Likes

Here is the complement opposite scenario:
Calculate the needed Force to hit a target.
(Video would look almost the same)
UPBGE03_hitpoint_neededForce.blend (915.7 KB)

#Controls
#A/D            move Target left/right  
#W/S            move Target up/down
#Mousewheel     Rotate canon (angle)
#Space          shoot

#docs:
# https://physics.stackexchange.com/questions/27992/solving-for-initial-velocity-required-to-launch-a-projectile-to-a-given-destinat?rq=1
# https://forum.unity.com/threads/how-to-calculate-force-needed-to-jump-towards-target-point.372288/
2 Likes

variables of equations of both files are now named the same and have the same Drawline-code.

1 Like

Little throw-back npc that just moves as fast as needed to be in time
UPBGE03_hitpoint_1npc.blend (932.8 KB)

1 Like

Great, I had all the work and now the 2 npcs play without me.
UPBGE03_hitpoint_2npcs.blend (1002.2 KB)

2 Likes

1 FPS Player - 1 npc
UPBGE03_hitpoint_1npc_1player.blend (2.7 MB)

#Controls
#WASD           Move
#Mouse          look
#Space          jump
#Mousewheel     Force
#LMB          shoot
#RMB          Grab
1 Like

Interpolated velocity between points within a given time. NPC now starts and stops smoothly instead of abruptly.
UPBGE03_hitpoint_1npc_1player_smooth.blend (2.7 MB)

1 Like

Here’s a VolleyBall Field Demo:
https://www.dropbox.com/scl/fi/47foculd3v6383ihfiroj/UPBGE_0.3_VolleyBallField.blend?rlkey=rdkoj1eqtlxl65wp2jmid3vp1&st=s0bjfn3d&dl=1

Controls:
WASD           Move
Mouse          look
Space          jump
Mousewheel     Force
LMB          shoot
RMB          Grab

Enter          Restart Game


Credits:
VolleyBall
https://blendswap.com/blend/12793

Girl model and animation from
https://quaternius.com/packs/ultimatemodularwomen.html

Mechanics:
https://blenderartists.org/t/python-calculate-physical-bullet-hitpoint-needed-force/1531581/7?u=musikai

docs:
 https://physics.stackexchange.com/questions/27992/solving-for-initial-velocity-required-to-launch-a-projectile-to-a-given-destinat?rq=1
 https://forum.unity.com/threads/how-to-calculate-force-needed-to-jump-towards-target-point.372288/
2 Likes