Jump to content
Sign in to follow this  
Amazed

Determine Object Dimensions(Width,Depth,Height) - That possible?

Recommended Posts

Hey!

I am looking for a way to determine the dimensions of arbitrary objects (in meters).

The script commands apparently only retrieve the position of objects relative to the map.

Does anybody know how?

Alternatively a list with all object dimensions would do the trick just as well. When push comes to shove I would content myself with a 1m tall object. :)

Thanks in advance!

Share this post


Link to post
Share on other sites

Thanks man!

Now I got this result for an object:

[[-0.318,-0.251953,-0.757122],[0.318,0.251953,0.757122]]

Does that mean the height of the object is |Ymin| + Ymax or in numbers ~1.5m ?

Share this post


Link to post
Share on other sites
Thanks man!

Now I got this result for an object:

[[-0.318,-0.251953,-0.757122],[0.318,0.251953,0.757122]]

Does that mean the height of the object is |Ymin| + Ymax or in numbers ~1.5m ?

From quick testing it seems correct. You can use abs (min X/Y/Z + max X/Y/Z) to get the real size of X/Y/Z of the object in meters.

Share this post


Link to post
Share on other sites

Are dimensions taken via bounding box exact object dimensions, or can be eg bigger, than object in fact? Also will be dependent on animation state of given object.

Anyway, probably useless, but theoretically I can imagine some object dimensions scanning code, that utilizes lineIntersectsWith. We need two points from opposite sides of that object, close to it, eg just a bit outside bounding box, initially at the ground level, then Z axis is increased for both points simultanously with very small steps (or, if better, with some bisect techniques), as long, as command will return false, means not obstructed by object LOS between points. Then increased value will mean object height with good accuracy. Same can be repeated for all three axis or "by diagonal".

Share this post


Link to post
Share on other sites
Are dimensions taken via bounding box exact object dimensions, or can be eg bigger, than object in fact? Also will be dependent on animation state of given object.

From my quick tests, the result seemed to be pretty accurate and hopefully enough for most needs.

Share this post


Link to post
Share on other sites

I do not know, perhaps depends. Some months ago, just before introducing LOS commands, did own LOS checking script, where was used boundingbox. Then I did some tests, sometimes with weird results. For example road segment, that should be quite flat, has eg such boundingbox: "[[-4.04312,-6.81569,-5.42941],[4.04312,6.81569,5.42941]]" (8x13,5x11).

Share this post


Link to post
Share on other sites

Thanks guys!

You are quite the helpful crowd! :)

Share this post


Link to post
Share on other sites

Well the bounding box of an object don't have to reflect the actual size because a bounding box is used to show the outer boundings of an 3D object.

For example if said object is a composition of several 3D objects, the bounding box will also be bigger as the object itself.

In some of my tests the bounding box results showed some weird values because the object was at the bottom of the bounding box with at least 5 meters of empty area till the top bounding - this happens when the 3D Object while beeing edited is saved that way (it's useful ingame if you have to align several objects into one and dont want to do math for every single object, e.g. the LHD)

I also could be wrong but I learned to question the values returned by boundingBox :D

Share this post


Link to post
Share on other sites

Hm that changes the game.

Well do you know of any objects that are exactly 1m tall and present one continuous area at that side?

And while we are at it how can I make any object receive damage and test for it? For example every time I hit an object I want a hint to be triggered.

What I tried:

Init field of object:

this addEventHandler ["Hit", {_this execVM "hint.sqf"}];

hint.sqf:

hint "damage";

Seem to only work with pop-up targets.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×