Coordinates intersecting - ballpark answer needed

Started by
22 comments, last by Malonn 5 years, 3 months ago

I love this forum.

I guess I'll have to "fudge" the dimensions.  I'll see if I can't figure out an average of all interior meshes.

"GetBoundingBox"only works for projectiles and actors, so I can't use it.  I'm placing everything except those two, basically.  I can use this though, just guesstimate the numbers.  Tedious editor work, but it is a solution.

I can get the bounding radius... the math will be different and I don't know how to get there. 

Advertisement
23 minutes ago, Wyrframe said:

If you have access to OBSE, then you can call the function GetBoundingBox, which gives you the center and size of the bounding box.

I was just writing this... ninja'd.

13 minutes ago, Malonn said:

GetBoundingBox"only works for projectiles and actors, so I can't use it.  I'm placing everything except those two, basically.  I can use this though, just guesstimate the numbers.  Tedious editor work, but it is a solution.

So i guess you're trying to do this to a static world object?

I'll continue my googling then.

I appreciate the help, but GetBoundingBox won't work.  The box I need to check for intersection is a static; not mobile.  A limitation of the extender, I suppose.

The best on-the-fly approximation of size is "GetEditorSize".  I can use GetBoundingSphere, though I'll have to strain Google's servers for the math to do it.  If it can be done, that is.

Sphere check is pretty easy, is the distance less than the radius?  Inside.

10 minutes ago, Malonn said:

I can use GetBoundingSphere

Determining if something is in a bounding sphere is simple.

You just need to check the distance between the center of the sphere to the point and compare it with the sphere’s radius.
If this distance is less than the radius, then the point is inside the sphere.

<edit>

Hive mind above...

 

Sounds simple enough, but one big (I think) problem.  I don't have the center of the sphere.  Just the radius.  I have the coordinate of the mesh bound by the sphere.  Same with bounding box; I have the coordinates of it's location (though where that point is relative to the mesh is a bit of a crap shoot).  Is there a way to calculate center from what I do have?

You all have narrowed this down from a big problem to one that is potentially solved, I'll just have to fudge the math some.  Kinda guess at sizes.

Having said that, keep the ideas coming.  I'd rather it be more accurate than ballpark, but I can live with ballpark.

I think the best tools I have to work with for accuracy are GetEditorSize and GetBoundingRadius,  The former is my hunch for best results.  From my Googling, the radius is not enough, I need the center and I need 4 points to calculate the center, which I don't have.

Let me ask you all this: GetEditorSize supposedly returns Height + Width + Depth / 3.  Can I get a decent approximation of axis range using that?  Sorry for stupid questions, obviously math was never something I excelled in.

You'll probably have to do some testing as there's no standard location for a point of origin on a mesh(non primitive meshes that is)..  It's a fairly safe assumption though that the point of origin is going to be bottom center for most models. ;)  From there you should be able to make adjustments to find the offset you are looking for.

Yeah, I checked a few and the origin point varies.  It's mostly in the center, but it's Z varies.  I'll keep looking.  I whipped up something using info here and this page and had positive results, but far from perfect.  It ended up being stuff that should have been placed wasn't.  I need to tighten it up.  Not sure where to go from here.

But, kudos to all here.  You've been an immense help.  But, hey, if you have more suggestions, keep them coming.  I'm going to try Wyrframe's code real quick...

Wyrframe's code is the most accurate using all of the guesses for stuff I have to use.  It's very good.  Hopefully I can iron out the kinks.  Suggestions are always welcome. :)

This topic is closed to new replies.

Advertisement