arrow physics.

Thanks a lot,

y+ arrow, y+bow?

Yeah,
I guess most 2d games in blender make use of the x and z axis but I just use the y and z axis without any reason lol.
So would be really cool if you wanted to rotate everything in your blend along the z axis with 90 degrees and adjust the scripts to that, since I dunno how to get it right.

It’s line 21 in arrowBrains.py

Also, blender’s text editor does have a search function. Ctrl+F to find it.

also, the apply force will need reworked. and the bow facing nines right?

It’s line 21 in arrowBrains.py

Also, blender’s text editor does have a search function. Ctrl+F to find it.

I used Ctrl F but line couldn’t be found.
Pretty confused now because I don’t know which blend I have to use since I cant find that line at all on line 21…

here you are, Y+ is now forward. also note, (hold CTL to release mouse control) as a example (so you can have a ui etc in game)

The ctrl thing is just done with bricks in the bow, so it’s easy to undo as well.

Attachments

archeryBprFixed (Impact) (Y).blend (507 KB)

Yep. Have the force applied along the Y axis instead of the X (line 9 in fire.py). Rotate the bow/arrows 90 degrees (and apply rotation!), plus probably a few other things.

This was obviously not intended to be a plug-in for Hikojj’s game. He will have to adapt it to fit his own unique environment. Since I have no access to that, I am in the dark as to what that is.

It all went a bit strange, but first of all I want to thank you both for putting so much afford in my problem ;).

This was obviously not intended to be a plug-in for Hikojj’s game. He will have to adapt it to fit his own unique environment. Since I have no access to that, I am in the dark as to what that is.

Yep, but I think I will succeed adapting it for my game.

Thanks both :slight_smile:


Ok, got it work now.

But how to make the arrow less heavy? Because the effect is toooo overpowered

add some dampening to the arrow, or reduce the force applied in the apply force section with a multiplier

arrow.applyForce([0,own[‘force’]*60,0], True) (adjust the 60)

in Fire script

If you want it to be realistic, then that’s just the way it is. It will go further if you increase the speed of the arrow.

Increasing the force applied to the arrow will lessen its arc, but will also yield faster projectiles (which may not be what you want).

If you don’t care about being realistic, and you just want more independant control over the speed/path of your arrows, you might try applying some artificial ‘anti-gravity’ to the arrows…
put this at the end of arrowBrains.py, within the elif statement (that is, indent these lines). I tested it out on our little prototype and it seems to be working well.


G = logic.getCurrentScene().gravity
force = own.mass * G[2]   #our mass times world's Z gravity
damp = 0.1     #lower this for "heaviness", increase for more "floatiness"
own.applyForce([0,0,-force*damp], False)

Adjusting ‘damp’ will let you adjust how much arc you will get. 0.0 will act as they do now under normal physics. 1.0 should make them fly straight without any arc at all.

do you want the line path or the arc?

you can have some base force, like

arrow.applyForce((0,(own[‘force’]*60)+25),0),1)

Yeah this works great!

Thanks guys for helping me, its 100% done now :slight_smile: