No collision while going backwards

Blitz3D Forums/Blitz3D Programming/No collision while going backwards

danjo(Posted 2004) [#1]
i have a simple camera moving about.. using MoveEntity
the cam has a radius, and walls cam camera both have collision types set to sliding.
the camera cannot pass thru walls going sideways or forwards, but if you go back (MoveEntity cam,0,0,-0.5)
i can go right thru (created entities) that have the collision types set on them. - turn it around and go forward at the entity you just went thru, and it stops on it.
has anyone seen this problem before?


BlackD(Posted 2004) [#2]
Got example code?


danjo(Posted 2004) [#3]
heres relevant code im using..

Global playertype=1,walltype=2

EntityRadius editor_cam,3.8
EntityType editor_cam,playertype

Collisions playertype,walltype,2,2


If level(a,b)=17
	e.editor_block=New editor_block
	e\entity = CopyMesh (innerwall_1)
	e\x=xx
	e\z=zz
	PositionEntity e\entity,e\x,-8,e\z
	RotateEntity e\entity,0,0,180
	ScaleEntity e\entity,1,1.1,1
	EntityType e\entity,walltype
EndIf


Function editorcam_view()
If MouseX()<50 Then TurnEntity editor_cam,0,1,0
If MouseX()>550 And MouseX()<=600 Then TurnEntity editor_cam,0,-1,0
If KeyDown(203) Then MoveEntity editor_cam,-.5,0,0
If KeyDown(205) Then MoveEntity editor_cam,.5,0,0
If KeyDown(200) Then MoveEntity editor_cam,0,0,.5
If KeyDown(208) Then MoveEntity editor_cam,0,0,-.5
End Function


you can see im not doing anything out of the ordinary.
the collisons work when the cam goes forward or sideways into the meshes, but when you spin around, you can travel backwards thru them.


Ross C(Posted 2004) [#4]
Spin around? Blitz doesn't handle rotating entities, because technically the entity isn't moving. Same if you scale an entity, the collision won't detect. Have you tried going straight back?


jfk EO-11110(Posted 2004) [#5]
Probably it has something with fustrum culling to do. if the wall in your back is completely out of sight and it is a seperate mesh, it will not be rendered. probably it will also not process collision. The same happens when you hide something with HideEntity: Collision is not processed any longer. Well if it is that way, it may be named a Bug. Quick solution would be to addmesh the walls to the ground, so there is always something in view. But of course thisisn't a proper solution since it forces to render more than what's neccessary.

Well I am not sure if it has anything to do with this issue at all. It never happened to me cause my level is one single mesh (not very efficient with large levels, I know)


Damien Sturdy(Posted 2004) [#6]
this wont have anything to do with it as things miles off camera still collide.


big10p(Posted 2004) [#7]
Yes, blitz's entity clipping shouldn't affect collisions at all. The only thing I can think of at the moment is that if the collision sphere of your camera is already colliding with the level mesh when you start, then collisions won't work.


danjo(Posted 2004) [#8]
ross c, when i said spin around, i meant turn your camera away from the mesh, and travel straight backward. you go straight thru it.
it does seem like collisions are not being processed when you cannot see that entity it is colliding with, as jfk mentioned. (much larger wall entities) you cannot travel backwards thru.. just the smaller ones.
its odd that it works fine when you travel around forwards or even sideways, but as soon as you travel backwards, the collisions do not work.
* i should mention the unit sizes here.
the camera's entity radius is 3.8
the offending meshes are 8x8 units
the main walls that arent affected are 240x1 units.


its not causing me any greif, because the "bug/occurance" of going thru the walls is no major deal. there is some much larger outside walls that contain the level, which you cant go thru, so atleast i have limited the camera to stay inside the level.


TomToad(Posted 2004) [#9]
Which version of Blitz3D are you using? If you're not using 1.88, give it a try and see if it solves your problem. The 1.88 version supposedly fixed some collision bugs. If you are using 1.88, see if you can downgrade to an earlier version and see if it works, possibly the upgrade might've broken something that was originally working.


danjo(Posted 2004) [#10]
using 1.88


jfk EO-11110(Posted 2004) [#11]
notice, "fixed collision bugs in 1.88" basicly means Collision as we know it was edited, so there could be a new bug, in theory.

danjo - did you try to add the wall to the floor mesh? You only need to take care to use PositionMesh to position the wall initially (not PositionEntity), then use

Addmesh wall, ground
freeentity wall

Now the wall should be part of the ground.

BTW maybe it's a graphics card driver problem, try to update your drivers. Do you got a radeon chipset? I had serious problems with randomly disappearing terrains on my radeon, and after updating the driver from ati.com the problem was solved.


Clarks(Posted 2004) [#12]
the face normal of the triangle that you're colliding with
sometimes cause this problem. i experienced the same thing.


danjo(Posted 2004) [#13]
k, after testing, this is what is happening. the offending meshes which collisions are not working on when you cannot see them - ie: travel backwards thru them, are the COPYMESH(entities)
i am using copymesh, to add more meshes, and even after the copymesh, placing the entitytype on them, it only works if you can see the mesh.
on the original mesh i am copying from, i placed in with them, and collisions work in any facing direction on that one. so it is a problem with COPYMESH.

as i said, its not great big deal that you can travel thru the meshes for this instance, as its a level editor - but it still doesnt solve a problem if i or someone else comes up against this dilema of using COPYMESHed entitys for collisions (even backward collisions)


fall_x(Posted 2004) [#14]
I had a similar problem, but with copyentity. I have a bunch of trees. If I load them all with loadmesh it works great, but if I load it once and then make all the trees with copyentity, my transparant leaves are not shown most of the time (they pop in and out of the view).
I don't know if this has anything to do with your copymesh problem though.


John Blackledge(Posted 2004) [#15]
Whoa, both of the above replies sound pretty crucial to me (suggesting Eek! a bug in Blitz).
Anyone been able to nail this down?


danjo(Posted 2004) [#16]
copymesh has not affected any other things i have found. it's alpha transparency works ok, etc.
the thing is, the collison on the copymesh works, just not when you can see the entity its colliding with.