Opened 2 years ago

Last modified 7 months ago

#13177 new defect

TWINE: Tank is stuck

Reported by: vvs- Owned by: mgerhardy
Priority: normal Component: Engine: TwinE
Version: Keywords: collision-detection
Cc: Game: Little Big Adventure

Description

In Hamalayi Range scene 63 after capturing tank it can't leave this scene and become stuck. This makes it impossible to continue without cheating.

You can use the same savegame as in #13168

Attachments (3)

scummvm-lba-cd-00000.png (312.4 KB ) - added by vvs- 2 years ago.
script1.2.log (74.7 KB ) - added by mgerhardy 2 years ago.
added script dump for actor 1 (the tank)
Bildschirmfoto vom 2022-05-29 16-03-49.png (50.6 KB ) - added by mgerhardy 22 months ago.

Download all attachments as: .zip

Change History (27)

by vvs-, 2 years ago

Attachment: scummvm-lba-cd-00000.png added

comment:1 by mgerhardy, 2 years ago

Priority: normalhigh

by mgerhardy, 2 years ago

Attachment: script1.2.log added

added script dump for actor 1 (the tank)

comment:2 by mgerhardy, 2 years ago

Priority: highblocker

comment:3 by mgerhardy, 2 years ago

error must be here: Animations::processActorAnimations the if block with actor->_staticFlags.bComputeCollisionWithBricks

comment:4 by mgerhardy, 2 years ago

The problem is in the lines:

checkActorCollisionWithBricks(actor->_boudingBox.mins.x, actor->_boudingBox.mins.y, actor->_boudingBox.mins.z, 1);
checkActorCollisionWithBricks(actor->_boudingBox.maxs.x, actor->_boudingBox.mins.y, actor->_boudingBox.mins.z, 2);
checkActorCollisionWithBricks(actor->_boudingBox.maxs.x, actor->_boudingBox.mins.y, actor->_boudingBox.maxs.z, 4);
checkActorCollisionWithBricks(actor->_boudingBox.mins.x, actor->_boudingBox.mins.y, actor->_boudingBox.maxs.z, 8);

comment:5 by mgerhardy, 2 years ago

should be fixed in master with 3d5d5317a88b8e96b220ad65b0d930c93dd024bb

comment:6 by mgerhardy, 2 years ago

Owner: set to mgerhardy
Resolution: fixed
Status: newclosed

comment:7 by mgerhardy, 22 months ago

Resolution: fixed
Status: closednew

This fix introduced another issue in collision in e.g. scene 35 (the sokoban scene) - you can now move crates into the walls

comment:8 by mgerhardy, 22 months ago

Script of the tank (actor 1)

COMPORTMENT main 
  IF FLAG_GAME 78 == 1 
    SUICIDE 
  ELSE 
    SET_COMPORTMENT 1 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 1 
  ONEIF HIT_BY == 7 
    SET_TRACK 1 
    SET_COMPORTMENT_OBJ 8 2 
  ENDIF 
END_COMPORTMENT 
END

Script of the hero (actor 0)

COMPORTMENT main 
  IF FLAG_GAME 74 == 1 
    SET_COMPORTMENT 1 
  ELSE 
    SET_COMPORTMENT 3 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 1 
  ONEIF LIFE_POINT_OBJ 7 == 0 
    IF FLAG_GAME 78 == 0 
      SET_FLAG_GAME 73 0 
      SET_FLAG_GAME 72 0 
      SET_FLAG_GAME 74 0 
      SET_FLAG_GAME 75 1 
    ENDIF 
  ENDIF 
  IF COL == 1 
    IF CURRENT_TRACK_OBJ 7 == 107 
      SET_DIRMODE NO_MOVE 
      INVISIBLE 1 
      ANIM 0 
      SET_BEHAVIOUR NORMAL 
      SET_TRACK 0 
      CAM_FOLLOW 1 
      SET_TRACK_OBJ 1 0 
      SET_COMPORTMENT 2 
    ENDIF 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 2 
  IF CURRENT_TRACK_OBJ 1 == 100 
    SET_FLAG_GAME 78 1 
    IF FLAG_GAME 6 == 1 
      BODY 0 
    ELSE 
      BODY 1 
    ENDIF 
    POS_POINT 15 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 3 
END_COMPORTMENT 
END

Script of the helper (actor 7)

COMPORTMENT main 
  OR_IF FLAG_GAME 77 == 1 
  OR_IF FLAG_GAME 89 == 0 
  IF FLAG_GAME 74 == 0 
    SUICIDE 
  ELSE 
    SET_COMPORTMENT 1 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 1 
  IF ZONE_OBJ 0 == 0 
    IF ZONE == 0 
      SET_FLAG_GAME 73 1 
      SET_FLAG_GAME 72 0 
      SET_FLAG_GAME 74 0 
    ENDIF 
  ELSE 
    IF ZONE_OBJ 0 == 1 
      IF ZONE == 1 
        SET_FLAG_GAME 73 0 
        SET_FLAG_GAME 72 0 
        SET_FLAG_GAME 74 0 
      ENDIF 
    ELSE 
      SET_FLAG_GAME 73 0 
      SET_FLAG_GAME 72 0 
      SET_FLAG_GAME 74 1 
    ENDIF 
  ENDIF 
  SWIF DISTANCE 0 > 2500 
    SET_DIRMODE FOLLOW 0 
    ANIM 27 
  ENDIF 
  SWIF DISTANCE 0 < 2000 
    IF DISTANCE 4 < 6000 
      SET_DIRMODE FOLLOW 4 
      ANIM 144 
      SET_COMPORTMENT 2 
    ELSE 
      ANIM 0 
    ENDIF 
  ENDIF 
  IF FLAG_GAME 71 == 1 
    IF LIFE_POINT_OBJ 7 < 50 
      SET_LIFE_POINT_OBJ 7 50 
    ENDIF 
  ENDIF 
  ONEIF LIFE_POINT_OBJ 4 == 0 
    SET_DIRMODE NO_MOVE 
    IF LIFE_POINT_OBJ 2 > 0 
      IF ZONE == 0 
        SET_TRACK 10 
      ELSE 
        SET_TRACK 0 
      ENDIF 
    ENDIF 
    SET_COMPORTMENT 3 
  ENDIF 
  ONEIF ZONE == 3 
    IF FLAG_GAME 78 == 0 
      SET_DIRMODE NO_MOVE 
      IF LIFE_POINT_OBJ 5 > 0 
        SET_TRACK 3 
      ELSE 
        IF LIFE_POINT_OBJ 6 > 0 
          SET_TRACK 4 
        ENDIF 
      ENDIF 
      SET_COMPORTMENT 4 
    ENDIF 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 2 
  OR_IF DISTANCE 0 > 3000 
  IF LIFE_POINT_OBJ 4 == 0 
    SET_DIRMODE FOLLOW 0 
    ANIM 27 
    SET_COMPORTMENT 1 
  ENDIF 
  IF FLAG_GAME 71 == 1 
    IF LIFE_POINT_OBJ 7 < 50 
      SET_LIFE_POINT_OBJ 7 50 
    ENDIF 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 3 
  ONEIF CURRENT_TRACK == 100 
    SET_DIRMODE FOLLOW 2 
  ENDIF 
  ONEIF CURRENT_TRACK == 101 
    SET_DIRMODE FOLLOW 3 
  ENDIF 
  ONEIF CURRENT_TRACK == 110 
    SET_TRACK 0 
  ENDIF 
  ONEIF LIFE_POINT_OBJ 2 == 0 
    IF LIFE_POINT_OBJ 3 > 0 
      SET_DIRMODE NO_MOVE 
      SET_TRACK 1 
    ENDIF 
  ENDIF 
  IF LIFE_POINT_OBJ 2 == 0 
    IF LIFE_POINT_OBJ 3 == 0 
      SET_DIRMODE FOLLOW 0 
      SET_TRACK 2 
      SET_COMPORTMENT 1 
    ENDIF 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 4 
  ONEIF CURRENT_TRACK == 103 
    SET_DIRMODE FOLLOW 5 
  ENDIF 
  ONEIF CURRENT_TRACK == 104 
    SET_DIRMODE FOLLOW 6 
  ENDIF 
  ONEIF CURRENT_TRACK == 105 
    SET_TRACK_OBJ 1 2 
    MESSAGE 2 
    SET_DIRMODE FOLLOW 1 
  ENDIF 
  ONEIF CURRENT_TRACK == 108 
    EXPLODE_OBJ 1 
    EXPLODE_OBJ 1 
    EXPLODE_OBJ 1 
    EXPLODE_OBJ 1 
    EXPLODE_OBJ 1 
  ENDIF 
  ONEIF LIFE_POINT_OBJ 5 == 0 
    SET_DIRMODE NO_MOVE 
    IF LIFE_POINT_OBJ 6 > 0 
      SET_TRACK 4 
    ENDIF 
  ENDIF 
  IF LIFE_POINT_OBJ 5 == 0 
    ONEIF LIFE_POINT_OBJ 6 == 0 
      SET_DIRMODE NO_MOVE 
      SET_TRACK 5 
    ENDIF 
  ENDIF 
  ONEIF CURRENT_TRACK == 106 
    SET_DIRMODE NO_MOVE 
  ENDIF 
  ONEIF CURRENT_TRACK == 107 
    SET_DIRMODE FOLLOW 1 
  ENDIF 
  ONEIF COL == 1 
    SUICIDE 
  ENDIF 
END_COMPORTMENT 
END 
Last edited 22 months ago by mgerhardy (previous) (diff)

comment:9 by mgerhardy, 22 months ago

get the helper with debug commands

set_game_flag 77 0
set_game_flag 89 1
set_game_flag 74 1
change_scene 63
toggle_god_mode

force the track 2 for actor 1 (the tank) to start without playing the scene

change_scene 63
scene_actor 1
toggle_free_camera
set_track_obj 1 2
Last edited 22 months ago by mgerhardy (previous) (diff)

comment:10 by mgerhardy, 21 months ago

found a revision that worked for both test cases: 0a4460ba343fb394f2385559bab90b404140dd25

Last edited 21 months ago by mgerhardy (previous) (diff)

comment:12 by mgerhardy, 21 months ago

comment:13 by lotharsm, 21 months ago

Priority: blockerhigh

comment:14 by mgerhardy, 21 months ago

The tank is hanging on brickShape ShapeType::kStairsBottomLeft

comment:15 by vvs-, 21 months ago

Hmm... Now that you've said this, I remember that there is a bug where Twinsen would get stuck in a corners (doors, bricks). That happens quite often.

comment:16 by mgerhardy, 20 months ago

a report from a user that might also be related to this collision bug:

  • you can also sometimes go behind tiles, or get stuck near a door that's opening

comment:17 by mgerhardy, 20 months ago

94e339a382f7f417ca369602c882d4f3c5b8e0ce reduced the hack to the tank scene. this makes the sokoban scene work again.

comment:18 by mgerhardy, 19 months ago

Priority: highnormal

Changed prio to normal because a hack is in place.

comment:19 by mgerhardy, 13 months ago

https://github.com/mgerhardy/lba1-classic-community/tree/debug contains a version with a few debug options compiled in

comment:20 by xesf, 10 months ago

I wonder if this issue has to do with Bounding Boxes not rotating when doing the collision check?

The truck doesn't have a squared bounding box, so when it turns, if the Bounding Box has the same orientation it can leave to collision issues.

comment:21 by mgerhardy, 10 months ago

Maybe - I am unsure. I wasn't able to tackle the issue yet. If you maybe still remember those parts... any help would be more than welcome.

comment:22 by xesf, 10 months ago

Sure, I can have a look.

comment:23 by xesf, 10 months ago

It worked fine. I wonder this has been fixed before.

comment:24 by mgerhardy, 7 months ago

Keywords: collision-detection added
Note: See TracTickets for help on using tickets.