opentomb / OpenTomb

An open-source Tomb Raider 1-5 engine remake
http://opentomb.github.io/
GNU Lesser General Public License v3.0
1.38k stars 143 forks source link

Lara collides with invisible meshes #102

Open vvs- opened 9 years ago

vvs- commented 9 years ago

Model 22 in TR1 has collision enabled which prevents Lara from going through.

EDIT: that seems to be not a camera target but some other service entity.

vvs- commented 9 years ago

Turned out that "baddie" function now doesn't disable collisions either. An invisible collision shapes are left behind.

vvs- commented 9 years ago

Baddies are fixed in 9609635438c724a024d2ce7461a4d4b52c729f17, but service entities still require fixing the script.

vvs- commented 9 years ago

Model 22 is a spawn point. But how it determines what entity to spawn? Based on the level?

Lwmte commented 9 years ago

Yes, I think it's hardcoded... It contains no additional info, timer field is also empty (although Core never used timer field for another purposes very well until TR3 or TR4 anyway).

vvs- commented 9 years ago

The automatic static mesh collision introduced in ee6e5ae01e9e44345c7c9d01313f0d367da73059 is not working any longer.

vvs- commented 9 years ago

For some reason Lara can't fall into water at the exit from Tomb of Qualopec. I don't see any collision mesh there and she can jump forward. After that she can successfully re-enter and everything works normal from that point. I've seen such cases on other levels too.

Lwmte commented 9 years ago

Latter bug is probably related to collision detection. There's another funny bug, if you push action and then forward somewhere inbetween two squares with low ceiling, Lara will try to grab the ceiling!

Regarding static mesh collision, it stopped working before or after merge?

vvs- commented 9 years ago

Before the merge, of course. No collision testing is possible after that.

vvs- commented 9 years ago

The processing for staticmesh_script.lua was added in e71d0bd8925eab82c735fd3d26ce1e15c3e562f1 but it didn't work because of a bug which was fixed in aae4b0e2873e4ddb2a23cc6ea40bf7589e1354ae. Since then automatic collision doesn't work because of a bug in that script. This code just overrides it:

if((static_tbl == nil) or (static_tbl[id] == nil)) then
        return COLLISION_TYPE_STATIC, COLLISION_SHAPE_BOX, nil;
vvs- commented 9 years ago

One simple workaround for this bug:

diff --git a/scripts/staticmesh/staticmesh_script.lua b/scripts/staticmesh/staticmesh_script.lua
index 308347f..5b84315 100644
--- a/scripts/staticmesh/staticmesh_script.lua
+++ b/scripts/staticmesh/staticmesh_script.lua
@@ -16,7 +16,7 @@ static_tbl = {};    -- Define static mesh property table.

 function getStaticMeshProperties(id)
     if((static_tbl == nil) or (static_tbl[id] == nil)) then
-        return COLLISION_TYPE_STATIC, COLLISION_SHAPE_BOX, nil;
+        return nil, nil, nil;
     else
         local coll, shape, hide;
         if(static_tbl[id].hide ~= nil) then hide = static_tbl[id].hide else hide = false end;
Lwmte commented 9 years ago

Fixed in 3f78f53.

vvs- commented 8 years ago

Related to #50.

vvs- commented 8 years ago

Seems, like this need back porting too.

vvs- commented 7 years ago

It seems that setEntityCollision doesn't affect statics anymore. These commands became no-ops in level scripts. Also, I see no way to disable collision for static 37 in Tomb of Tihocan.

EDIT: Ok. I can disable it through static_tbl. We need to fix level scripts.

vvs- commented 7 years ago

In Unfinished Business many statics doesn't have collision enabled.

TeslaRus commented 7 years ago

static 37 fixed in https://github.com/opentomb/OpenTomb/commit/e0839706911e6727b1e70bf2aa8a557c19816dc5

vvs- commented 7 years ago

Thanks. It's not a blocker anymore, But it's still a valid issue for other instances, e.g. in Lost Valley.