FAQFAQ    Board RulesBoard Rules    SearchSearch    LotteryLottery    RouletteRoulette    UsergroupsUsergroups
     RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Shop    Log inLog in 
View posts since last visitView your postsView unanswered posts

What makes glass breakable?

 
Post new topic   Reply to topic    Mafiascene.com Forum Index -> Ask a Modder - Modding
View previous topic :: View next topic  
Author Message
AsaSK

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 24 Feb 2013
Posts: 701
Location: London, England
13614 Bank Notes
Items

PostPosted: Tue Jun 26, 2018 1:41 pm    Post subject: What makes glass breakable? Reply with quote

For a while I've been wondering what makes breakable glass in Mafia breakable. I understand that part of it is an OBB collision (material 24), but I can't seem to replicate the broken glass falling to the ground like a physical object (on my model it just disappears when hit).
I'm also puzzled by the fact that the breakable glass panels inside the various scene.4ds models don't appear to be pre-fragmented in their meshes, so how does the game know where to make the 'breaks'? Evidently the break pattern differs between glass panels (Hotel Corleone doors vs skylight, for example).

Anyone have insight into this?
_________________

The official Mafioso Mod thread
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 187

405 Bank Notes
Items

PostPosted: Sat Jun 30, 2018 4:06 pm    Post subject: What makes glass breakable? Reply with quote

AsaSK wrote:

For a while I've been wondering what makes breakable glass in Mafia breakable. I understand that part of it is an OBB collision (material 24), but I can't seem to replicate the broken glass falling to the ground like a physical object (on my model it just disappears when hit).

It's a bug in MWE. See this post for details.

You can fix the issue with a hex editor by looking for glass mesh's name in the klz file and changing the 01 that's located four bytes before the name to 02.

AsaSK wrote:

I'm also puzzled by the fact that the breakable glass panels inside the various scene.4ds models don't appear to be pre-fragmented in their meshes, so how does the game know where to make the 'breaks'? Evidently the break pattern differs between glass panels (Hotel Corleone doors vs skylight, for example).

Anyone have insight into this?

Static breakable glass is typically prefractured into small individual meshes which are linked to OBB primitives with material 24. If the game detects a collision with one of these boxes, it deletes the corresponding box alongside the associated mesh and spawns the glass particles that fall to the ground.

For doors the designers used the glass tag on the glass meshes. In case of mise08-hotel the glass panels and the wooden frames around them are a single mesh object which is why the whole construction breaks when it is hit. This is different from mise19-banka where the glass tiles of the doors are individual meshes and hence can be destroyed individually.
Back to top
View user's profile Send private message
AsaSK

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 24 Feb 2013
Posts: 701
Location: London, England
13614 Bank Notes
Items

PostPosted: Sun Jul 01, 2018 7:13 pm    Post subject: What makes glass breakable? Reply with quote

Thanks for the replies! Brokenneedle I haven't seen that before, I'm going to try making some custom damage models. ASM thanks very much! It's great to know how this works, i'll play around with it tonight.
_________________

The official Mafioso Mod thread
Back to top
View user's profile Send private message
AsaSK

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 24 Feb 2013
Posts: 701
Location: London, England
13614 Bank Notes
Items

PostPosted: Tue Jul 03, 2018 12:52 pm    Post subject: What makes glass breakable? Reply with quote

So I tested it, and for some reason I can't get a custom model to smash (the physical collision works, you can't walk through it, but it doesn't take any hit collision) - oddly enough though, it works for all the models the game uses. The hex fix you suggested was applied for this test, but I even tried without it.




_________________

The official Mafioso Mod thread
Back to top
View user's profile Send private message
Duelist

Member
Member


Joined: 06 Nov 2016
Posts: 129
Location: Poland
264 Bank Notes
Items

PostPosted: Thu Jul 05, 2018 7:50 pm    Post subject: What makes glass breakable? Reply with quote

It doesn't work because OBBs are a different kind of collisions. They are not 3D objects but flat 2D planes lying horizontally, without height. In order to get it work you have to rotate them 90 degrees from horizontal to vertical. You might have noticed that all OBBs have 0,2 height scale (y axis). While they don't have any height it is important to keep it set like this. As the actual collision is in the middle and you can actually pick it up in MWE. So don't worry about collisions visually overlapping the objects. Each collision should be linked to a particular mesh as well.
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 187

405 Bank Notes
Items

PostPosted: Thu Jul 05, 2018 10:16 pm    Post subject: What makes glass breakable? Reply with quote

What Duelist said. In case you use CTRL-K to create the OBBs I have a development build of MWE that generates properly rotated boxes. PM me if you're interested.

I did some experiments and there seem to be additional requirements for breakable glass, though. In mise04-saliery it works perfectly for Mesh08 (a glass mesh part of one of the meeting room windows), door_dvuX01 (the door to the meeting room), @hqobr04.Box01 (the horse picture in the pool room) and plot_brana (the wooden gate at the entrance to the bar's backyard) but I was not able to get it to work for plot01 (one of the wooden fences in the backyard) for example: It is initially solid (as expected) but hitting it merely disables the collision detection; it does not spawn any glass particles nor does it delete the actual mesh object. Maybe the mesh itself needs to satisfy certain requirements, like a maximum number of faces? Thinking
Back to top
View user's profile Send private message
flovivi

Junior Member
Junior Member


Joined: 22 Dec 2014
Posts: 51

297 Bank Notes
Items

PostPosted: Mon Jul 16, 2018 10:45 pm    Post subject: What makes glass breakable? Reply with quote

As far as I remember, you need to add an extension to the model with hexeditor. To flag it as glass object. Then simply add a collider to it with Mafia world editor and it should break when you shoot at it.

I remember djbozkosz is extremely advanced with these kind of things. You could try to leave him a message.

I think besides changing the the 4ds file with hexeditor there isn’t really another way to achieve this.

Best regards.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Mafiascene.com Forum Index -> Ask a Modder - Modding All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

Generation Time: 0.038 | Queries: 22