Collisions and Bullets

Blitz3D Forums/Blitz3D Beginners Area/Collisions and Bullets

Ace Killjoy(Posted 2008) [#1]
This has probably happened before.
I set up collisions for my bullets so that they would stick in the ground like arrows, but when I gave the EntityType command for the bullets I found that I could only fire in certain areas.
I have yet to clean up my code so please bear with me:




Ace Killjoy(Posted 2008) [#2]
Oh, yes.
I forgot to mention erlier that the bullet appear to fire from other places besides where the gun is.
I don't know if that makes a difference but I thought I should mention it.


Nate the Great(Posted 2008) [#3]
What if you turn while the bullet is in the ground?

wouldn't it make the bullet turn too because you made the gun the parent of the bullet?

P.S. Code is very confusing. :)


Ace Killjoy(Posted 2008) [#4]
Like I said, I have not cleaned up my code yet so I don't blame you for being confused.

As to the turning thing, the gun is parented to the camera, the bullets are suposed to originate from the gun and after they're fired they continue in their original direction, thus I am free to move afterward.

But now that I've added the EntityType command to bullet(i) it only fires from my gun in certain places.
I noticed that if I bloat up the size of the bullet, I see that it somtimes fires from the ground in the distace.
I don't know what to do about that.


Ross C(Posted 2008) [#5]
First off, when using function, ALWAYS make your variables you intend to keep throughout the code, GLOBAL, else they may be overwritten very easily.

Second point, would be to use Types instead of an array if you know how to use them.

Thirdly, onto your code. I see no real need to make your bullets stick into the ground :o) But, i reckon your entityRadius is probably too big, in relation to your bullet size. By default the entityradius is set to 1, so if your bullet is pretty small, then it probably will get stuck on alot of things.

Try setting all your bullet radius to something very small, like 0.1 or smaller, and see if the problem still occurs.

Again though, i would have your bullet stuck in the ground. Each bullet you create, is going to be a seperate surface, and even if the polygon count isn't high, 100 surfaces or bullets will slow your graphics updates down a fair bit.


Ace Killjoy(Posted 2008) [#6]
I'll need to look into Globals and Types some more.

I wanted my bullets to stick in the ground because my next step was to use HideEntity when they hit the ground. When I discovered that the bullets were not behaving like I intended, I decided to hold of on the HideEntity command for the time being.

As for my radius, it's already .02,.02 (I'll try deleting the extra .02).
I think I actually tried taking that code off and it didn't do anything (except defaulting the radius to 1).

I'll see what happens. Thanks for the tips.


Ace Killjoy(Posted 2008) [#7]
Well, the problem doesn't seem to be the EntityRadius.
On a side note, I'm going to be gone until Friday night so I'll let you guys look at it some more. Tell me if you see anything.
Thanks.


Ross C(Posted 2008) [#8]
Would help if you posted some media, so we can test this :o)

May have something to do with the blitz terrain as well.


Ace Killjoy(Posted 2008) [#9]
I'm back.
I'll try using another height map, but when I get a good converter I'm going to redo the terrain.
How do I post media?


Terry B.(Posted 2008) [#10]
Put the Showentity Command Last in the fireing part.
For example:

What you did:
ShowEntity bullet(t)
EntityParent bullet(t),gun
PositionEntity bullet(t),1,-1.5,-10

What Might world:
EntityParent bullet(t),gun
PositionEntity bullet(t),1,-1.5,-10
ShowEntity bullet(t)



Try that out.


Ace Killjoy(Posted 2008) [#11]
Thank you Terry.
That worked, not completely sure how, but it worked!
I'm still wondering how to post media, though.


Terry B.(Posted 2008) [#12]
It works because, when you position entity, the radius is still in effect, so if you show entity AFTER you position it, the radius doesnt effect the position.


Ace Killjoy(Posted 2008) [#13]
Ok, that sounded strange but I think I understood enough of it.
Thanks again.