Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / No way of retrieving the dimensions of a loaded 3D object?

Author
Message
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 3rd Apr 2016 20:06
I would like to retrieve the dimensions of a loaded 3D object. Is there a way?
-----------------------------------------------------------
Using AGK2 Tier 1
[a http://www.fantomgl.com]fantomEngine[/a] - A powerful 2D game framework
Jeff Miller
19
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 4th Apr 2016 03:10
I was looking for the same thing just earlier this week. In DBPro it was an expression, Object SizeX(), etc.
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 4th Apr 2016 12:59
I think we are out of luck Jeff. I can't find anything.
-----------------------------------------------------------
Using AGK2 Tier 1
[a http://www.fantomgl.com]fantomEngine[/a] - A powerful 2D game framework
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 5th Apr 2016 12:49
Hi Mike and Jeff,

I do it this way:

Sorry its a copy paste from a larger function so you need to make it into a function yourself



It will just look at all vertex data in the object , and take the highest and lowest values.
objsizex# objsizey# objsizez# is the size of the object.

Hope you can use it.
best regards Preben Eriksen,
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 5th Apr 2016 13:48
Thanks Preben. Definitely something. Maybe to slow at runtime, but if these values are stored after loading, then yes. Very good!
-----------------------------------------------------------
Using AGK2 Tier 1
[a http://www.fantomgl.com]fantomEngine[/a] - A powerful 2D game framework
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Apr 2016 18:22 Edited at: 5th Apr 2016 18:23
just a other idea is using =ObjectRayCast( objID, oldx, oldy, oldz, newx, newy, newz ) to find the bounds.

+
GetObjectRayCastX
GetObjectRayCastY
GetObjectRayCastZ
AGK (Steam) V2.0.18 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 5th Apr 2016 19:08
I too noticed this glaring omission from AppGameKit when I started my foray into 3D. While the function by Preben is appreciated, a user should not be expected to dive into memblocks just to get a loaded object's size. I resorted to using third party model analyzers and even DBPro itself to help calculate the base object size. It appears DB Pro is still far ahead of AppGameKit when it comes to 3D commands.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 5th Apr 2016 19:48
Quote: " It appears DB Pro is still far ahead of AppGameKit when it comes to 3D commands."

Which is to be expected since DBpro is 15 years old, and AGK2's 3D commands are about 6 moths old.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 6th Apr 2016 02:58
Quote: " Which is to be expected since DBpro is 15 years old, and AGK2's 3D commands are about 6 moths old."


Fair enough, but without any future roadmap and all of the Kickstarter goals reportedly already integrated, it is hard to judge its progression. I say this having followed AppGameKit from its inception and with the realization that many sectors of it are still basically unchanged from then including a more complete implementation of Box2D that has been requested since 2011.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 6th Apr 2016 10:19
Quote: "many sectors of it are still basically unchanged"

Yep. I hear that. But it is slowly getting there.
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 6th Apr 2016 12:53
I think they did not want to bloat AppGameKit with what they possibly see as unnecessary commands for things that can be handled by the Tier 1 coder.
I guess from their perspective when you need to make sure that the commands you add work on all platforms some commands will not
have high priority. I have also missed these extra commands that DBPro had. Here are a few that I brought over from DBPro source.


The coffee is lovely dark and deep,and I have code to write before I sleep.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Apr 2016 00:05
I've added the following commands for the next version
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 7th Apr 2016 01:53
Thank you, Paul!
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 7th Apr 2016 08:24
Thanks Paul, are these dynamic, means when a model is animated, these values are newly calculated?
-----------------------------------------------------------
Using AGK2 Tier 1
[a http://www.fantomgl.com]fantomEngine[/a] - A powerful 2D game framework
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Apr 2016 10:48
@Stab In The Dark: Your WrapAngle code looked like hard work, so I re-wrote it for you:



(It's faster now too!)

Benchmark test:

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Apr 2016 12:25
Fmod...why did nobody tell me about Fmod!

<Goes to rewrite much code />
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 7th Apr 2016 12:43
Quote: "Fmod...why did nobody tell me about Fmod!"

Mobiius likes this.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 7th Apr 2016 12:53 Edited at: 7th Apr 2016 12:53
@CJB
Your version of WrapAngle does not work for negative numbers - Stab's does. But here is a modification of CJB's that also works for negative numbers:



I also modified your benchmark test to choose random number in the range -9999 to 9999 and this is still a faster method even with the recursion.
AGK V2 user - Tier 1 (mostly)
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Apr 2016 15:02
Or slightly faster this:
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Apr 2016 17:22
Of course it may be less than -360...



I imagine there's a faster way to do this too.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 8th Apr 2016 07:23
My version covers all negative values, including those less than -360 (recursion)
AGK V2 user - Tier 1 (mostly)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Apr 2016 08:17
ah yes, so it does!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 8th Apr 2016 16:07
Just to clarify the code was a straight copy from the DBPro C++ source, I take no credit for it.
Nice work speeding it up.
The coffee is lovely dark and deep,and I have code to write before I sleep.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 11th Apr 2016 15:20 Edited at: 11th Apr 2016 15:21
My code also allow any value but without the recurrsion. The fmod already limits the result to +/- 360
V2 T1 (Mostly)
Phone Tap!
Uzmadesign

Login to post a reply

Server time is: 2024-11-25 08:35:29
Your offset time is: 2024-11-25 08:35:29