www.tombraiderforums.com (https://www.tombraiderforums.com/index.php)
-   Tutorials and Resources (https://www.tombraiderforums.com/forumdisplay.php?f=28)
-   -   TRNG - New collision features (https://www.tombraiderforums.com/showthread.php?t=212033)

AkyV 02-09-15 08:12

TRNG - New collision features
by Paolone

Download demo project


From version there are new features about the collisions.

The main target of these new collision is to permit to Lara to walk, climb or monkey on statics and moveable items.
Another usage could be the creation of collisions for the future modelling of 3d room geometry using meta2tr program.

As we'll see the above target has been reached with some tricks based on invisible room collisions.

Although it is easy apply this trick, in many circustances we'll have to work to limit the discordances between shape of the item and the shape of collisions.

In this tutorial there are different suggestions about how adjusting these differences.

The source problem is that the invisible room collision have only the same shapes we could give to sectors and therefore they are not very fine.

AkyV 02-09-15 08:14

How walking on Statics or Moveables


The trick to allow to Lara to walk over items is based on following simple rules:
  1. Remove, from our item, its collision.
    This operation is different in according with type of item. If the item is a static just you add in its OCB value the number 4.
    While if the item is a moveable you have to use an action trigger to disable its collision:
    "Collision. Disable the collisions of <#>Moveable"

  2. Add new invisible collisions moving up room collisions with the new "Collision. ..." flipeffects.

AkyV 02-09-15 08:17

The new Flipeffects for the Collisions

The new flipeffects about collisions permit to move up or down, the floor or the celiling collision in similary way how we should do to build the room with [+] [-] floor/ceiling buttons.

The difference is that with our collision flipeffects the visible shape of the room will remain the same and only the (invisble) collisions of the room will be changed.

All collision flipeffects permit to move up or down the floor or the ceiling and some of them give you also the chance to create slopes or triangles normal or splitted.

Fake Triggers

Technically it's important understand that the flipeffect collision triggers are not true triggers.

I used the flipeffects only to store in a given position of the room the changes to perform before building the level but these trigger will be not performed in game.

The "fake" nature of these triggers means that:
  • The collision triggers will be not executed in run time (during the game) but in building time.

  • The triggers will be not present in tr4 file like triggers because they will be removed before outputting the .wad file

  • For above reasons you cann't export collision triggers to perform them in triggergroup or in animcommand because there is no code in trng engine to perform them. All computes are in ngle program.

  • When you are working on overlapped rooms, linked with vertical doors, you have not to place these triggers on the floor of bottom room when you want have their effect in a top room.
    Above method works fine for real triggers, but with these fake trigger you have to place the trigger always in the room where you want really change the collision and not in the room at bottom of casted rooms. (At least you didn't wish change own that bottom room, of course)

    For example in the demo for collision, in the room 4, I placed some triggers on the ceiling (to easy the selection of transparent floor) of top room, when I had to move down the ceiling of top room to create the monkey attribute on the crane arm

AkyV 02-09-15 08:34

Collision Trigger Groups

Collision Flipeffects

In the field "Text to find" you have a suggestion about the single words divided by spaces to type in white box at left of [Find <#>] button in Trigger Type window to locate fastly the wished group of flipeffects



Text to Find



Floor with Slope

With this group of triggers you can move up or down the floor, setting or less a slope on the floor.

Set North <&>Slope-Collision changing floor of (E)Clicks
Set South <&>Slope-Collision changing floor of (E)Clicks
Set East <&>Slope-Collision changing floor of (E)Clicks
Set West <&>Slope-Collision changing floor of (E)Clicks

The picture has been got with following trigger:

; <#> : Collision. Set West <&>Slope-Collision changing floor of (E)Clicks
; <&> : Slope Collision with height= 2
; (E) : Increase floor collision by 4 clicks



Text to Find



Floor with Triangle

With this group of triggers you can move up or down the floor, setting or less a singe vertex to increase furtherly to create a triangular peak.

Set North-West <&>Tri-Collision changing floor of (E)Clicks
Set North-East <&>Tri-Collision changing floor of (E)Clicks
Set South-East <&>Tri-Collision changing floor of (E)Clicks
Set South-West <&>Tri-Collision changing floor of (E)Clicks

The collision of the picture has been got with this trigger:

; <#> : Collision. Set North-East <&>Tri-Collision changing floor of (E)Clicks
; <&> : Triangular collision with height= 2
; (E) : Increase floor collision by 6 clicks



Text to Find



Floor with split triangle

With this group you can move up or down the floor and then you can add a split triangle, where the break-line is in a different position respect to common triangle. (See the picture)

Set North-West <&>Tri-Split-Collision changing floor of (E)Clicks
Set North-East <&>Tri-Split-Collision changing floor of (E)Clicks
Set South-East <&>Tri-Split-Collision changing floor of (E)Clicks
Set South-West <&>Tri-Split-Collision changing floor of (E)Clicks

The collision of the picture may be got with this trigger:

; <#> : Collision. Set North-West <&>Tri-Split-Collision changing floor of (E)Clicks
; <&> : Triangular Split collision with height= 3
; (E) : Increase floor collision by 5 clicks



Text to Find



Ceiling with Slope

This group moves down or up the ceiling adding a further slope in wished direction.

Set North <&>Ceiling-Slope-Collision changing ceiling of (E)Clicks
Set South <&>Ceiling-Slope-Collision changing ceiling of (E)Clicks
Set East <&>Ceiling-Slope-Collision changing ceiling of (E)Clicks
Set West <&>Ceiling-Slope-Collision changing ceiling of (E)Clicks

The collision of image has been got with following trigger:

; <#> : Collision. Set North <&>Ceiling-Slope-Collision changing ceiling of (E)Clicks
; <&> : Slope Collision with height= 2
; (E) : Decrease ceiling collision by 8 clicks



Text to Find



Ceiling with Triangle

With this group you can move down or up the ceiling adding a further decreasing for a specific corner, getting a triangular speak.

Remark: for the ceiling collision is not foreseen the split triangle.

Set North-West <&>Ceiling-Tri-Collision changing ceiling of (E)Clicks
Set North-East <&>Ceiling-Tri-Collision changing ceiling of (E)Clicks
Set South-West <&>Ceiling-Tri-Collision changing ceiling of (E)Clicks
Set South-East <&>Ceiling-Tri-Collision changing ceiling of (E)Clicks

The collision of the picture has been got with this trigger:

; <#> : Collision. Set South-West <&>Ceiling-Tri-Collision changing ceiling of (E)Clicks
; <&> : Slope Collision with height= 2
; (E) : Decrease ceiling collision by 8 clicks



Text to Find



Flat Floor Collision

If you want move up or down the floor with no triangle or slope, just you select any collision floor triggers and set as triangle or slope 0 clicks.
In this way you got only a movement of the floor preserving the flatness of the sector.

For example the picture at the left could be got with one of following triggers:

; <#> : Collision. Set East <&>Slope-Collision changing floor of (E)Clicks
; <&> : Slope Collision with height= 0
; (E) : Increase floor collision by 6 clicks


; <#> : Collision. Set North-East <&>Tri-Collision changing floor of (E)Clicks
; <&> : Triangular collision with height= 0
; (E) : Increase floor collision by 6 clicks

In fact, when you set 0 clicks for slope or triangle height is not important the facing (east, north, south ect.) and neither if it was a triangle or a slope.

Remark: in spite of this speech I discourage to use a "split triangle" collision as flat collision, because the split triangle change some field in internal structures that could be modify something also if there is a null height about the clicks.

So try to use slope or common triangle to have flat collisions.

AkyV 02-09-15 08:45

Adapting the Objects to the Collisions

Apparently it should be better adapting the collisions to the objects but, unortunately the room collisions are very "raw" and for this reason it's not always possible change them to follow the precise shape of the object.

For this reason it's better trying the opposite: modify a bit the shape or position of the items to overlap in better way the possible room collisions we could create.


In above A picture we can see the items in first room of the collision demo, and in B picture the collisions created with collision flipeffects.

Above it's only an exmple, of course, in the project you'll se nothing of alike but only the triggers placed in those sectors.
Anyway, looking above pictures we can understand our problem: while some item have a shape very alike than room collisions (like the sarcophagus), other items (like the statue of the lion or the mummy ) are not so much alike and this situation could create some boring situation in game.

For example if you try to go on the mummy you'll see that, in some position, lara will be hanging in the empty, although only with a little distance.

Differently the sarcophagus is very good, becuase it was exactly 2 sectors for 1 sector, with an height of (exaclty) three clicks.

Instead the lion statue is a bit disaster. When lara jump over him, she will slide down, and this it's ok, but at start of this swimming, her feet will be enter the lion's mane, for almost half leg. This is bad. But the worse is that the lion is too slim respect to sector width and lara will bang versus an invisible wall on lateral sides of the lion.

Tips and tricks to solve some uncompatibilities

When we found some of these problems we could try to fix them in following ways:
  • If you are able to model 3d solit with metaseuoia or 3d max, you can simply restyle the object to get that its main lines were aligned with sector grid and slope types allowed in ngle.
  • You can use triggers to move the item to close it to sector grid. This simple trick allows to gain very much.
  • When the problem is an empty space where there are invisible collision but not the shape of the item, you could add another item in that empty space to justify that transparent collision with this new little item.
  • If the problem is the opposite of previous point, i.e. a side of the object goes off from collision shape, where lara can pass across it, we could use a collision panel (see below in this document) to forbid to lara to reach that crossable zone.
  • With some objects another intelligent solution could be to renounce...
    It's not necessary that lara gets on all items of the level. Some items could have a shape fully uncompatible with room collisions so in this case it will be better to renounce.
The tricks in the Demo Level

The main problem was about the enemy jeep.
That shape seemed good to adapte it to room collision, but when I placed the jeep in the project I discovered this:


The jeep was not correctly aligned with the sector grid.
In these cases it's easy solve the problem: just you apply a trigger to move it in correct position.

; <#> : ANIMATING6 ID:15 in sector (2,4) of Room2
; <&> : Move. Move to east <#>animating for (E)units (one sector = 1024)
; (E) : Units = 632

The enemy jeep is the animating 6, of course.

With this trigger (performed at start of the level) the jeep had the bottom aligned with sector grid, but now there was another problem:


The jeep was not enough big to fit two sectors of width. So I tried to place a collision with a slope in left sector but also in this way the problm is clear: lara remains in air closed to front of the jeep.

To solve this problem I found an item with a shape compatible with the space to fit.

Since that little guard-rail was too little to cover that click of empty I placed two items in same position, and then I used a flieffect to move one of them a bit to east to fit better the empty space.

Now the result is enough good:


Moving items to align them to collision grid


The method of moving items to get the best alignment to collision grid has been used other two times in demo project.
In above picture you can see the room where it has been used many times: to move the bridge and the giant a bit to east, because (look the project in ngle to understand) the bridge was not aligned with sector grid.

Then it has been moved also the little column at right of lara in above picture. You can see in the ngle what was its original (and bad) position.

Simulate rounding collisions

When we use items with rounded shapes and "fill" them with transparent collisions we have many advantages: we can have shapes different by usual box-style and in same time we can walk, climb or monkey these new items, but there is also a disadvantage: the rounding shapes of these items is different than sqaured collisions we applied to them, so in some corners lara could be hanged to invisible walls.

To understand this problem we could give a look to sarcophagus item:


In above picture you can see the green zones where there is a transparent collision.

This is not a big problem, since everytime we create rounded shapes it's normal there will be some of these litte zones with invisible collisions.

Anyway we could try at least to avoid that lara was able to hang on those (missing) corners.

We can realize this target using this special collision trigger:

; <#> : Collision. Set the <&>Side of closed sector as non-hangable from Lara
; <&> : West Side

Playing the demo you can see the result.

Lara will be able to hang on the sarcophagus where the shape is squared with real corners, while she will be not able to hang in the rounded sides of the object.

Remark: differently by other collision triggers, this trigger is a real trigger and it could be exported.

If you look carefully the first room, you see I placed also a condition trigger on sides of sarcophagus to forbid the hanging only in half sector where there is the missing corner, while in other west-side of the sector lara will be able to hang normally on the object.

To round the Sectors

The room collisions don't permit to round the shape of the sectors anyway you can round a bit the square moving up a triangle of that sector to stop lara in that corner.

You can see the example of the hovel in the demo project where the four corners of the hovel are diagonal collisions created moving up the correct triangle of that sector.

Another way is to use the set of collision panels you find in collis.wad file. See below.

AkyV 02-09-15 08:54

The Set of Collision Panels

The collision panel are items having the only target to set an invisible collision in the level.

They are not a full news, you saw invisible collision panels also in example of elevators to avoid lara falls down of the elevator floor.

Anyway there are some news in this new version.

You have a full set of collisional panel to have diagonals and invisble walls in different positions to cover all possible shapes.
The panels now have their own slot name to avoid overlapping with other animating items.

The engine applies to these collision panels a new collision procedure to be faster and to support also panel hight upto 8 clicks, while the common collision procedure didn't work fine with animating higher than 6 clicks.

About the choice of usage wheter room collisions or level panel collisions, you should remember that it's not possible walk, climb or monkey the collision panels, but you can create horizontal collisions more detailed using the panels.

My suggestion is to integrate these two methods to create invisible collisions, trying to prefer the room collisions when it's possible, since the room collision use less cpu time to be computed while the panles are new items in your map and it's better don't exagerate with their number.


All collision panels have a max height of 8 clicks (2 sectors) but you can move donw them in the floor to use also collision with littler collisions.

In above A picture you can see how a collision panel appears when you've just placed it: it has a one sector (four clicks) height.

You can move up it upto 8 clicks (B picture), but you can also move down in the floor to have only one click of height (C Picture) if you wish.

The Panels with full width

These are the four panels with full width.

You can have panels to cover each single click of the sector.









Little Panels

These little panels permit to create more detailed shapes working on a grid with half sector of alignment.









Samples about Collision Panels


I used two PANEL_CORNER to round the collisions of balcony.

Since I prefered avoid a squared balcony, I had also to build collisions in according with this round shape.

Another situation where I used collision panel has been in the room of the giant.


To use the suitable bridge I had to use a bridge with half width, i.e. half sector.

Since there is no way to create a collision at half of a sector using room collision, I used a serie of PANEL_MIDDLE items to build the collision in the half of the sectors following the bridge.

Looking the project you can see that in other side of the bridge I've not always used the panel collision, because in that case it was possible using some room collisions, so, to save items in the level, I used the ceiling collision moved down to stop lara in that direction.

Then I used also a PANEL_DIAGONAL item to avoid lara can jump on other half of collision other the bridge, because otherwise our trick will be discovered and lara will remain hanged in the empty.

AkyV 02-09-15 08:56

Limitations about the new Collisions

Other that the raw shape of the room collisions, the other limit is that the room invisible collisions are fixed, so we cann't move an item is using these room collisions since it will lose the collisions with this movement, and this it's not good.

If you need absolutely to have collisions on some item to move where lara was able to walk or climb, you can choose one of following tricks:
  • Using a pusjable object. These items have the chance to be walkable and climbable just you set correct OCB values. See the Pushable ocb in the Reference panel of NG_Center

  • Using a raising block, and then move it horizontally with the action trigger to move items.

  • Using a flipped room with a different position of room collision. So you'll have a main room with item in start position and collisions placed in that point. Then you'll have in the flipped room the same object in another position and in this other room also the collision will have another position to overlap the object in this final position.
    This trick has been used for crane arm. During the movement the crane has not really the correct collisions but it will have them at start and at end of the movement.

All times are GMT. The time now is 22:05.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.