# Coordinates intersecting - ballpark answer needed

## Recommended Posts

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.

##### Share on other sites
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.

Edited by Stragen

##### Share on other sites

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.

##### Share on other sites

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

Edited by Septopus

##### Share on other sites
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...

Edited by Stragen

##### Share on other sites

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.

Edited by Malonn

##### Share on other sites

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.

##### Share on other sites

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.

Edited by Septopus

##### Share on other sites

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...

Edited by Malonn

##### Share on other sites

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.

Edited by Malonn

## Create an account

Register a new account

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 12
• 9
• 11
• 15