Any ideas on this?

Blitz3D Forums/Blitz3D Programming/Any ideas on this?

Baystep Productions(Posted 2006) [#1]
I have a gun model, and I've attached it to the camera as this is a FPS game. Following me? Good.

It runs and looks fine, but it has a clipping problem with the other meshes, not uncommon. So I usualy just do something like EntityOrder -1 and it works.

Not this time, it doesn't clip, but now some of the triangles in the mesh are flipped.

Any ideas?


kevin8084(Posted 2006) [#2]
Sounds like a vertex order problem with your model. Either that or part of your view is actually inside the model.


Baystep Productions(Posted 2006) [#3]
It only screws up the models view only. It's like I fliped the vertex's. vertex order might be it, but how to fix it.


kevin8084(Posted 2006) [#4]
open in a modeller, select the face/triangle that is giving problems, and reverse vertex order. I don't know what modeller you use but Milkshape is great for this particular problem.


Baystep Productions(Posted 2006) [#5]
yup milkshape is what I got. but now it's even worse. I'll try to post a screenie


Baystep Productions(Posted 2006) [#6]



kfprimm(Posted 2006) [#7]
EntityOrder messes with the z-ordering of the meshes triangles, so there is nothing you can do about it.


MadJack(Posted 2006) [#8]
A few solutions would be

- if the gun has collided/clipped with another object, draw it back (as you would in real life) and flag that the gun can't fire in this position. I've seen a few games that take this option

- scale down the gun mesh, put position it closer to the camera so that it appears in the same position (bottom right) and at the same scale. Scale it down so that it is within the collision radius of the player

- do a 2 pass render. First render the scene, then (without Z buffer clearing), render the gun.


Bobysait(Posted 2006) [#9]
Generally triangle flip when they are in the CameraRange Near using a different entityorder for the mesh and the world.
So the best way may be to resize the mesh .


Tom(Posted 2006) [#10]
EntityOrder messes with the z-ordering of the meshes triangles, so there is nothing you can do about it.

Correct, I think the zbuffer is disabled when drawing meshes that use EntityOrder. But you should be able to compensate for this by using the function below. (demo included so you can see the difference)

PCD: Try running the gun mesh through this ZSortMesh() function. It rebuilds the triangle index so that polys furthest along the Z axis will get rendered first.




Pinete(Posted 2006) [#11]
Take a look at this link

http://www.blitzbasic.com/codearcs/codearcs.php?code=1271

Basically it renders the weapons with a second camera and always appears over the rest of models..
I've implemented it and works fine..

regards!,


bytecode77(Posted 2006) [#12]
in my little fps game, i have got a constant "WeaponAntiClipinFactor#"

the smaller this factor is, the nearer and smaller is the weapon!


Rroff(Posted 2006) [#13]
or you could just do something like tribes (and other games) and have the gun as an object in the world and test it for collisions with a simple trace, then either move the gun model back corresponding to the space infront, or rotate it so its pointing down a bit or at an angle left-right.


JoeGr(Posted 2006) [#14]
I could well be wrong here but perhaps its simply that part of the gun is closer to the camera than the 'near' CameraRange value. Try setting CameraRange 0.0001,1000 or something and see if that makes a difference.

EDIT - Actually, I think that's maybe what a couple of people were trying to say above.