OpenTomb icon indicating copy to clipboard operation
OpenTomb copied to clipboard

Lara collides with invisible meshes

Open vvs- opened this issue 9 years ago • 17 comments

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- avatar Jun 27 '15 17:06 vvs-

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

vvs- avatar Jun 27 '15 21:06 vvs-

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

vvs- avatar Jun 28 '15 18:06 vvs-

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

vvs- avatar Jun 29 '15 09:06 vvs-

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).

Lwmte avatar Jun 29 '15 10:06 Lwmte

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

vvs- avatar Jun 29 '15 21:06 vvs-

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.

vvs- avatar Jul 01 '15 10:07 vvs-

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?

Lwmte avatar Jul 06 '15 23:07 Lwmte

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

vvs- avatar Jul 07 '15 09:07 vvs-

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- avatar Aug 01 '15 16:08 vvs-

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;

vvs- avatar Aug 05 '15 18:08 vvs-

Fixed in 3f78f53.

Lwmte avatar Aug 07 '15 18:08 Lwmte

Related to #50.

vvs- avatar Jul 31 '16 11:07 vvs-

Seems, like this need back porting too.

vvs- avatar Jul 31 '16 11:07 vvs-

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- avatar Nov 21 '16 13:11 vvs-

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

vvs- avatar Dec 08 '16 13:12 vvs-

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

TeslaRus avatar Dec 25 '16 20:12 TeslaRus

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

vvs- avatar Dec 25 '16 20:12 vvs-