Does your game include arrows, grenades, missiles ?
Do you wonder how you can shoot your projectile so that it hits its target ?
Well, I created a blend that facilitates your work :
[ATTACH]178963[/ATTACH]
Blend below lets you play with different options, placed on the Arrow object :
-
short: shortest/longest Arrow trajectory
-
v0 : initial Arrow speed
-
g : gravity constant
-
lead : should the arrow aim where the Target is or where the Target will be ?
-
target : target Object
Press Space to shoot.
Press tab to change target
Press s to swap short to long
Press l to swap lead/no lead
Press UP/DOWN to change velocity
No air friction is assumed
Tell me what you think !
EDIT : New version lets you play with the parameters during the game
Code has been very much simplified
Attachments
williamtell.blend (1.11 MB)williamtell2.blend (1.73 MB)