I’ve been working on getting arrows to stick into some materials, like wood, and bounce off of others, like stone. It’s a simple logic setup, but it does not work perfectly. Anyone want to try to get it working more consistently? This represents my best effort so far, and it’s really not bad. I’ve tried all sorts of setup and tweaks, and this is the best I can do. No bow, so don’t critique that part. Infinite ammo. I’m just working on the bounce and stick parts.
Edit: March 10
NEW FILE
This is the latest file, if anyone wants it. Working very well now. Arrows still drop through the floor, but always stick and bounce.
Interesting. I think this is good for the resources.
But it is hard to see the arrows.
I think the problem you have here is that the arrow might be to fast. It partly crashed through the object. You should keep in mind that bullet ist not that good with small fast travelling objects.
I just working on something, that enables you to have a closer look on what really happens in your scene. I will let you know when it is done.
Thanks - I’ve tried many variations. The one I had the most hope for was a larger arrow head bounding box, invisible. Didn’t work any better. Concerning arrow size, well, arrows are hard to see from behind in most games, so if I want to keep it fairly realistic, I can’t make giant arrows. I could slow the arrows down a bit, but only a little, as real arrows are very fast. I tried simple a simple suspend dynamics setup as well. It’s always a case of the arrows not detecting the walls in time - some go through, some stop short…Very frustrating.
I’ve had a similar issue with Bullet…try making them LONGER…Take the invisible bounding box and extend it forwards, that way there will be more physics steps of the bounding box in the object, then slow them down a bit, hopefully that will fix it.
Thanks. I did stick my arrowhead bounding box way out front, didn’t work. I will go back to the simple, all encompassing box (as you suggest) and make it longer, and just bigger in general. The only issue is that if you fire an arrow near a “stick” object, say a wooden barrel, and just miss, the bounding box will still grab the side of the barrel, and do it’s job, sticking the arrow to the air just to the side of the barrel. I could accept that as ok if I could get the other part working…The idea behind having a big arrow head bounding box (not in the attached demo) was so that the only hing that would stick would be when the arrow head bounding box hits a wood or flesh object. That way, the fletching or side of the arrow wouldn’t stick to things. Complicated.
I will post a few more experiments later. Off to work.
Why don’t you measure the distance arrow travels in one Logic Tick. Then use python to cast a ray in front of the arrow to detect collision, if the ray hits something just snap the arrow to the hit position.
Ok, as suggested by Josip, I tried a ray sensor, but without the python, as I can’t code in python. This worked really well, so far. All the arrows stick. I will go a little further, and update the .blend file. Also, I pm’d Haidme and a few others. I just Heard back from Haidme with a .blend of arrows bouncing off a moving object really well. So, I think this project might soon have a permanent solution, which I’ll be happy to share.
3dmedieval - open the file I gave you with 2.49b or lower version of blender. the arrows are stabbing the object and stays there wherever they hit it.
The great thing about it is that, when the arrows hit the target they actually stick with the vertex area of the mesh, so in other words you can stab a moving creature in the leg or shoulder and the arrow will move with the sholder/leg animations.
The bouncing is observed only in blender 2.5x, because the code is only for lower versions of blender.(2.49b,2.48…)
Monster - I’m not sure what the FBF debugger is. Thanks for playing around with the file. I think it’s the small object issue. Haidme created a python version for his game and made a little demo, but I don’t know any scripting.
I’m currently working on a version that allows free moving in your scene (independent of any camera setting). As it is now 2.5 compatible, I was able to use it with your game. But it needs some more cleanup.
Here is another picture from your hidden layer. I think that shows you what happens with the arrows.
What do you see as happening there? I understand what I’m looking at, sure, but beyond that, I’m not sure. It shows arrows going through the wall, but as it does stop them most of the time, I’m not sure what can be done. To me it’s sort of like solving a problem like “2+2=4, but sometimes the GE thinks 2+2=5”. I think this is a case where python would do the best job. Haidme’s file worked really well, but I can’t mod it, because I don’t know python. Not a big deal, I just wanted to create a simple setup I could share with people making games with archery.
too much confusion going on with the logic bricks IMO
learning the basics of python isn’t that hard, i started a few weeks ago and i’m still picking up more ideas for ways to code
try this file out and see if there are any improvements. i used a small python script for parenting the arrow to any object with the property “stick”, on collision. hope it is of some use
Thanks, but at least on my computer, my original seems to work better. The arrows don’t hit where I aim, especially from an oblique angle shot, Bouncing works, but the arrows have enormous energy. When the arrows do hit, they don’t seem to stick any better. Sorry…
Concerning python, sure, I need to learn, but at the moment I have to much going on to tackle that as well. The logic buttons really aren’t that chaotic - I created a fairly simple setup. The other issue I have is that seemingly whenever they create a new blender, python files have to be updated. I’m trying to create something that will work well for a few versions, without the need for major python tweaks for every version.
Thanks anyway.
Does anyone else have a comparison? My original is in post 1. I’d be curious to see what other people have to say. It might jsut be my computer.