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 / OBJ not loading

Author
Message
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 24th Mar 2017 11:13
Hello

I try to load a simple obj file, but it's not working.
I use this code (there is a function added to zoom in and out or to pan the camera, incase the object would be large or anything like that)



The object man.obj is added as attachement.
Am I doing something wrong? Or is there something wrong with the importer?

Thanks
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 24th Mar 2017 12:32
Hmh, forgot to attach the man.obj!
See in this post!

Attachments

Login to view attachments
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 24th Mar 2017 13:25 Edited at: 24th Mar 2017 13:26
I think there might be something wrong with the model. When I ran your code it crashed.

I imported the model into blender and resaved it as an obj and everything seems to work fine. I used blender all the time and have never had a problem with any exported obj models.

I've uploaded the resaved model for you to try.
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB

Attachments

Login to view attachments
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 24th Mar 2017 19:52
Thanks 29 games!
Now it works indeed.

Another little question: I have a box of 1x1x1, and I like to think that 1 AppGameKit unit is 1 metre. I know that a unit is just a unit, but I want to be consistent in my application and just use 1 AppGameKit unit = 1 metre.
Problem is that that man object is like 300 metres high. How should I scale that down? E.g. That man should be 1.8 metre.

-Use set SetObjectScale() function to try and find the exact scale value to reach the 1.8 metre (put a box next to it or so?)
-Or use Blender to scale? Is this possible?

Thanks!
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 24th Mar 2017 22:07
Yes, you can scale the object in blender or any other 3D software.

I always set the size in Blender and also make sure that the model is orientated correctly. This generally makes it easier to manipulate the model in AppGameKit with minimal code. As a simple example, if I have human model and use the SetObjectLookAt command, I want the "person" to actually be facing in the right direction without any further code.

In terms of size, I tend to make humanoid models between 5 and 10 units high. It's a little bit long winded to explain, it just seems to fit nicely with the default camera ranges - near and far - but it's a case of playing around with it and is by no means a hard and fast rule.
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 24th Mar 2017 23:56 Edited at: 24th Mar 2017 23:57
In terms of the character size, it might be important to mention
That the 3D physics world works best when the average character is 72 units tall
You can read about it here: Create3DPhysicsWorld

Using AGKv2 Tier1
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 25th Mar 2017 00:29
I found that 1M in Lightwave is 1 unit in AppGameKit, which is great in one way, but not great for the physics engine if you want to use objects smaller than the recommended size (whatever it says in the help 2.5 or 3.5 units or something?).

So, I just upscaled everything x10 for now.My 6m tall robot made from 1x1x1 cubes is now made from 10x10x10 cubes and 60m tall, but as long as everything else is scaled accordingly then no problem. Might be an idea to have a global scale option in your code?

I also rigged up a test to duplicate the near/far camera and FOV so it matches lighwave exactly (for scene work or visualisation)

Not sure how the object loader treats other formats, but the 72 units seems to be like inches or something? Most unusual. Probably the 3D physics was developed by Mr Cholmondsey Warner..?

Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 25th Mar 2017 17:38
Thanks for the answers guys.
I asked a friznd to resize the model to 1.8 units in 3Ds Max.

I'm not using physics, but I saw in the doxumentation you can specify the scale?
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: 25th Mar 2017 18:49
Quote: "Probably the 3D physics was developed by Mr Cholmondsey Warner..?"


Look at it this way, I developed the physics and the most common size of characters in 3d games is 72 units tall.

nz0
You are showing your age, I had to google "Mr Cholmondsey Warner" and I am 51.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 25th Mar 2017 19:41
Hi Stab in the dark software.
Nice work you did on the physics!

I do not need it anytime soon (maybe never). But creating a physicsworld with a scale lower than 1, will that work?

I use 1 Metre = 1 unit. So if my character is 1.8 metres, the physicsscale would be 1/1.8 = 0.555555...
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: 25th Mar 2017 23:31
Quote: "I use 1 Metre = 1 unit. So if my character is 1.8 metres, the physicsscale would be 1/1.8 = 0.555555..."


Yes, that is correct.
The coffee is lovely dark and deep,and I have code to write before I sleep.
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 30th Mar 2017 20:12
Quote: "Quote: "Probably the 3D physics was developed by Mr Cholmondsey Warner..?"


Look at it this way, I developed the physics and the most common size of characters in 3d games is 72 units tall.

nz0
You are showing your age, I had to google "Mr Cholmondsey Warner" and I am 51."


72 inches is 6 feet, which is an average human reference size. I find it unusual if it's an imperial unit reference in an otherwise metric world. What other reference would 72 signify?

Mr Cholmondsey Warner was a character on a TV program in the 90s so I'm not that old (nearly as old as you though!)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 31st Mar 2017 09:20
Quote: "Mr Cholmondsey Warner was a character on a TV program in the 90s so I'm not that old (nearly as old as you though!)"

I'm 36 and know of this.
"Woman, know your limits!" lol
Signature removed by mod because it's larger than 600x120... please resize and try again.
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 2nd Apr 2017 10:05
Quote: "That the 3D physics world works best when the average character is 72 units tall"


I don't use physics that much so this is useful to know.

The reason I suggest a much smaller size was due to the camera ranges. The default camera range is 1 to 1000 units. I prevent the near plane clipping I generally use a sphere cast radius of 2. If the height of person is getting close to a 100 then that's only ten "human heights" (or about twenty to thirty metres) until object are out of camera range - which to me seems to close.

I know with DBPro that if the far camera range was too big then there would be problems with the zdepth but I don't know if this is true with AGK. I've also had minor issues with Blender when objects get to big.

I suppose it's a case of experimenting and doing what you need to do to get your game to work.
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB

Login to post a reply

Server time is: 2024-04-25 00:30:17
Your offset time is: 2024-04-25 00:30:17