• Break func_breakable_surf via Lua
    4 replies, posted
This is somewhat of a followup to my physically simulated bullets question. I've got them working great except that they don't break the windows on (for instance) cs_office. I've verified that they're hitting it, and they're even leaving the glass bullethole decals on them. But they're not breaking in such a way that the player can then walk through. What's the best way to do this? Leaving holes in the windows that correspond with how they were hit (ie: regular behavior) would be a bonus but just turning the glass into it's fragile, cracked state would be a victory.
[QUOTE=TomatoSoup;51776667]This is somewhat of a followup to my physically simulated bullets question. I've got them working great except that they don't break the windows on (for instance) cs_office. I've verified that they're hitting it, and they're even leaving the glass bullethole decals on them. But they're not breaking in such a way that the player can then walk through. What's the best way to do this? Leaving holes in the windows that correspond with how they were hit (ie: regular behavior) would be a bonus but just turning the glass into it's fragile, cracked state would be a victory.[/QUOTE] I believe you can run this: [code] ent:Fire( "shatter", "1 1 1", 0 ) [/code] in the bullet callback
Using Entity:Fire seems a little hacky to me... Can you tell me what the extra args for it do?
[QUOTE=TomatoSoup;51776911]Using Entity:Fire seems a little hacky to me... Can you tell me what the extra args for it do?[/QUOTE] Taken from [URL="https://developer.valvesoftware.com/wiki/Func_breakable_surf"]Valve's Wiki[/URL] it does this: [quote=Valve Wiki] Shatter <vector> Shatter the window. Input a vector. First two coordinates are the X,Y center of the shattering (as values from 0-1). The third coordinate is the radius of the shatter, in inches. [/quote] I don't think it's hacky at all, it's actually how bullets do it normally. [editline]4th February 2017[/editline] Only thing I can't help you with is how you'll calculate the vector on the glass for it to be in the right place. But I'm sure you'll figure that out easily
I ended up just hardcoding it to "1 1 0" so that the glass breaks but doesn't make any holes. The reason for this was that the breakable isn't collideable anymore after the first hit, so I couldn't add any more holes to it. But apart from that, it's great! Thank you very much!
Sorry, you need to Log In to post a reply to this thread.