Hoamaii Posted March 6, 2016 Share Posted March 6, 2016 Hi guys, Can someone help me reduce the size of a trigger box's nif? I'm trying to spawn a Trigger Box in game - 'triggerbox256x128' from meshes\traps - which does the job I need it for but I need it to have a definite size - that one is the smallest one I found fitting my purposes and it's still 3 times too big. I need it to be approximately 30% of its Vanilla size. For the moment, I'm using 'SetScale(0.3)' in my spawning script, but my undestanding is that using that function too often can cause CTDs. It'd be safer if I could spawn it exactly the size I need. It has a specific collisionObject (bhkSimpleShapePhantom) and I don't know how to create collisions in 3DS - so far I've used NifConvert and Chunk when I occasionally needed to create collision for a static object (but that can - seldom - lead to CTDs too...). I'm not sure resizing it can be done directly in NifSkope and even if it can, I wouldn't know how. Any help would be greatly appreciated, thanks :). Link to comment Share on other sites More sharing options...
icecreamassassin Posted March 6, 2016 Share Posted March 6, 2016 In NIFSkope all you have to do is right click on the NiTriShape you want to adjust and choose Transform -> Scale Vertices then when you are done, right click on it again and do Tranform -> Apply then save it as a new NIF I assume that you are having the activator spawned in various places based on the player's position rather than at a specific spot right? Also if an otherwise working mesh is crashing the game or previewer or CK after it's had it's chunk merge collision built, that usually means there are too many polys in the collision mesh, usually caused when you copy the original model to use as the collision mesh if it's a complex model Link to comment Share on other sites More sharing options...
Hoamaii Posted March 6, 2016 Author Share Posted March 6, 2016 Yeah that rescales the niTriShape alright, but what about the collision object? I was under the impression that rescaling niTrishapes in Nifskope may cause issues (don't know which) when the collision box is not rescaled accordingly. Also I need the collision object to be no bigger than a few units because it's actually the collision object which helps detect events, right? Not sure I'm entirely correct but I believe the niTriShape is just a marker, only helpful when used in the CK for positioning purposes. I tried to import that .nif in 3DS to check the collision object's size but for some reasons bhkSimpleShapePhatoms collision objects don't show up in 3DS. And yeah, I intend to spawn the activator in unspecific locations (not invisible for testing purposes so I can also check that it properly gets deleted when needed). It's intended to detect actors "enter" and "leave". Icereamassassin, while you're around, to you have any idea how I could detect an actor's exact 'center' position when he's using furniture? For instance, an actor in sleeping position has its center (GetPosition()) still detected to be at the entry point of the animation, when in fact the full mesh is quite a few units away from that point when the animation is done playing. Following up on my "sleep under blankets" idea from my Clearsky mod, here, trying to add that feature to the whole game... Also thanks for the tip about Chunk merge, I'll keep that in mind. Then thinking twice about what you said here, coudn't I try to use Chunk merge to generate the collision object I need - not a complex shape in this case, it's just a box with a very low polys number... Link to comment Share on other sites More sharing options...
icecreamassassin Posted March 7, 2016 Share Posted March 7, 2016 Ok I think I have this a little more clear in my head lol You basically need to take that vanilla trigger box and strip it down to just it's collision block and BSX flag block and save that as your template. Then you scale the original to the size you want, strip the collision block out and save the rest as your destination (final) file. After that strip it further down to just NiTriShapes with no other sub blocks inside and save it as the collision file. Then use those three files to re-chunk merge So each file would look like this: MyMarker.NIF (destination)BSFadeNodeBSX FlagsNiTriShape (with all sub blocks) MyMarkerCOL.NIF (Collision)BSFadeNodeNiTriShape (no sub blocks) MyMarkerTemplate.NIF (template)BSFadeNodeBSXFlagsbhkSPCollisionObject (with sub blocks) Not sure how chunkmerge works with phantom collision, but in theory this should work, just don't choose any collision material when you merge Link to comment Share on other sites More sharing options...
Hoamaii Posted March 7, 2016 Author Share Posted March 7, 2016 Will try that - thanks a LOT :) Link to comment Share on other sites More sharing options...
Tamira Posted March 7, 2016 Share Posted March 7, 2016 It is far easier:Resize your nif to 1/3 size as explained above (transform -> apply).Then expand the bhkSPCollisionObject in Nifskope until you come to the bhkBoxShape. Here you can edit the values for x,y,z to the 1/3 size you want. This reduces the size of the collision box. Link to comment Share on other sites More sharing options...
Hoamaii Posted March 7, 2016 Author Share Posted March 7, 2016 Oh, many thanks Tamira!.. That is a lot more simple and perhaps safer that doing this with Chunk :smile: After taking a closer look at the blocks, I was wondering about that but was unsure if it could safely temper with that. Actually, the original dimensions of the collision box of that 256x128 marker are: x = 0.9144y = 1.8288z = 1.8288 If that's in units, then that collision box is already VERY tiny. Perhaps I was mistaken to believe that it is the collision box boundaries which helps detect actors enter and leave - perhaps it is in fact the marker (niTriShape) which does that and the collision box is just here to help floor the nif in the CK or in game? Would you know which, from collision box or niTriShape, is the one doing the enter/leave detecting job? Now I'm thinking if that collision box is so small, maybe I don't really need to scale it down accordingly. From your experience, is there really a risk of CTDs using a .nif where niTriShapes have been resized and collision left untouched? One last question if I may: after resizing the niTriShape, I was tempted to Update Center/Radius in right click niTriShapeData -> mesh -> Update Center. Is that necessary you think? Thanks a lot to you both, guys, to help me better understand all this. Much appreciated :smile: Link to comment Share on other sites More sharing options...
Tamira Posted March 7, 2016 Share Posted March 7, 2016 I am not sure what units the x,y,z values are, you have to adjust them to the size you want.I hope you use the latest 2.0 series Nifskope which makes collision visible ... ? (I use 2.0.1 https://github.com/jonwd7/nifskope/releases/tag/v2.0.dev1)I had a closer look at the nif and noticed that the collision is out of place when both, NiTriShape and collision are resized. You can adjust the height of the collision by editing the z value in the bhkTransformShape of the collision. But in this case I'd recommend another, still easier workflow:Resize the complete BSFadeNode and again do transform -> applyThen right click the NiTriShape -> Havok -> Create Convex Shape. Choose a large value (1,0 is good) and you have a low poly convex shape collision for your trigger mesh. At last remove the abundant collision bhkBoxShape. Link to comment Share on other sites More sharing options...
Hoamaii Posted March 7, 2016 Author Share Posted March 7, 2016 Oo no, I was still using one the old 1.1 series - was fine enough for editing custom armors 3DS exports... Thanks for the link, I just downloaded the latest 2.0.2 Alpha (couldn't find the 2.0.1.) and yeah, it's great that you can finally visualize collisions!.. I just did what you advised, resized the whole BSFadeNode and created a convex shape which I used as Collision. Seems like it's exactly what I need - now I just have to test how it works in game. Think I'm gonna name that custom .nif Tamira something... ;) About that latest NifSkope version, I'm kind of bothered by the limited rendering options. I liked being able to highlight bones when working on armors - on this 2.0.2 version, no matter what I do I can't highlight selected bones, only mesh... Do you have these options in your 2.0.1. version and it's just missing in my Alpha version maybe? Anyway, thanks a LOT for your help, Tamira, you've taught me a lot about collision here! Cheers from Paris :). Link to comment Share on other sites More sharing options...
Tamira Posted March 7, 2016 Share Posted March 7, 2016 About that latest NifSkope version, I'm kind of bothered by the limited rendering options. I liked being able to highlight bones when working on armors - on this 2.0.2 version, no matter what I do I can't highlight selected bones, only mesh... Do you have these options in your 2.0.1. version and it's just missing in my Alpha version maybe? I do not work with armor and bodies so I never bothered about looking at bones. (Is it the symbol for Show Nodes maybe?) Link to comment Share on other sites More sharing options...
Recommended Posts