Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Tools => Topic started by: esarai on September 13, 2010, 07:30:23 pm

Title: Bounding Box error in PCS2.1 Alpha
Post by: esarai on September 13, 2010, 07:30:23 pm
Hey Gents, just wanted to let you all know that I found the PCS2.1 Alpha to incorrectly account for subobject bounding boxes.  The overall ship bounding box is too small for sections of the gun turrets, and thus half the barrels are not registering in collision detection.  Here's a link to the quasi-modpack that revealed this issue.

http://www.mediafire.com/?w52tt3d1joas18k (http://www.mediafire.com/?w52tt3d1joas18k)

I guess I'll also ask in the features thread for manual editing of the main bounding box, just as a failsafe for any similar occurrences. 
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: FUBAR-BDHR on September 13, 2010, 08:53:47 pm
That's not a bug. The definition of bounding box is the smallest box all parts of an object can fit into.  Thus detail0 has a bounding box just big enough for all of it to fit into not it's subobjects.  This is true in modeling programs as well.  If any subojects are outside of that bounding box then they will not have proper collision detection. 

There are 2 workarounds.  First is to move the subobject to 0,0,0 in the modeling program then move it back in PCS2.  This only works if the subobject fits in the bouding box when moved.  The second method is to place a small invisible cube (invisible texture that is) at the extents of +- X,y,z of the farthest poly on each subobject to extend the detail0 bounding box. You then need "dont collide invisible" in the ships flags.  BTW if you look at some of V's shipt they did this so it's not a new thing.   

Still a way to resize the bounding box in PCS2 would be great.
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: esarai on September 13, 2010, 09:48:27 pm
Thanks for the workarounds!  You're a lifesaver!

If any subojects are outside of that bounding box then they will not have proper collision detection.  

Yikes, I don't know about you, but that feels like an incredibly broken definition.  It seems as if the working definition of the header bounding box is that of the entire ship, not just detail0, and hence why I view it as a bug, because it can break models. Since the practical application of the bounding box requires that it be modified anyways, it might be prudent to have PCS2 make the header bounding box the bbox for the entire model, not just for detail0.

Unless of course that would break something or be unfeasible to implement, at which point a header bbox editor/visualizer would be excellent.

Thanks again!
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: FUBAR-BDHR on September 13, 2010, 10:55:50 pm
Remember modeling programs don't care about hierarchy it's just an object to them.  Anything under it is another object.  If you show bounding boxes in the modeling program and highlight detail0 that is the same bounding box you get in game. 

I wouldn't go as far as the automatic detail0 and all subobject thing as that could have implications with object that aren't supposed to have collision detection.  A simple way to resize the bounding box would be best.  Of course an auto-calc would be icing on the cake. 
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: chief1983 on September 14, 2010, 09:48:40 am
It would have to take into account allowable subobject motion, at least rotation, as we don't have translation yet.  Is the rotation predictable without defining in its axis in the model?  You were telling me the other day it's not necessary, but it seems like this is a case where it would be helpful at least.
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: FUBAR-BDHR on September 14, 2010, 02:56:26 pm
Well it would have to calculate it using uvec/fvec just as the game does as turrets do not necessarily have their rotation on the x,y, or z axis. 
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: Kusanagi on September 14, 2010, 11:12:02 pm
Why not have an ability in PCS2 to define the bounding box or autogenerate it like it does with paths and MOI? You would just need to input two fields for the coordinates of the lower right point and the upper right point on opposite corners of the box.

I too am noticing this when trying to get the turanic ion frigate to extend its wings.
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: Kazan on October 03, 2010, 03:07:29 pm
PCS2 should already be setting the bounding box for detail0 to fit all subobjects ...
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: FUBAR-BDHR on October 03, 2010, 03:25:27 pm
It never has as long as I've used it. 
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: Droid803 on October 10, 2010, 12:25:39 am
It doesn't but it really ought to.../me points to errors cropping up in FSU models

"Hacking" it with phantom polies doesn't sound like a real solution.
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: FUBAR-BDHR on October 10, 2010, 12:40:31 am
You can also get around it by making any LOD contain the whole model.  Quite a few older models only worked because detail1, 2, or 3's bounding box was big enough for the model to fit.  There is a problem with this method as well.  The target box is determined by the detail0 bounding box so the entire ship does not fit in the box.

Another method that was used some time ago was setting the center of all objects to 0,0,0 then moving them back to the actual coordinates in PCS2.  This actually gave them proper collision detection even if they were outside the bounding box.  Drawbacks to this method were inverted bounding boxes if the same piece was on both sides of the model.  Symmetrical left and right turrets for instance. 

So there have been a lot of workarounds over the years.  Even :v: used the invisible box method.  So being able to specify a bounding box would be almost a dream feature.
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: Droid803 on October 10, 2010, 12:48:34 am
Well, the bounding box is just a bunch of numbers stored in the POF file right?
It's not like it's calculated by the game.

I've hacked the Radius of models in a hex editor and allowing that to be changed in PCS2 as well would be nice.
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: Bobboau on October 25, 2010, 03:06:43 am
but PCS2 is supposed to be a model editor, you can move models around and supposedly at some point in the future you'll be able to edit the geometry, for this reason PCS2 MUST rebuild all the bounding box and radius data on the fly.
Title: Re: Bounding Box error in PCS2.1 Alpha
Post by: chief1983 on October 25, 2010, 10:03:06 am
Yup, it edits the native PMF format, it only exports to POF from that.  It doesn't live edit a POF file.  But having a small toolset of POF editing options built in could be useful.