About Store Forum Documentation Contact



Post Reply 
hmMaterial problem
Author Message
Tottel Offline
Member

Post: #1
hmMaterial problem
I'm trying to get the material type of a certain position in the world.

In EE 1.0, I would just use
Code:
Game.World.hmMaterial(pos)->user_type;
and compare with the material types.

Now in EE 2.0, the user_type has been removed (from the editor), and on top of that, I can't even get the materialPtr from a position. If I retrieve it, it's just faulty data.

E.g.:
Code:
MaterialPtr clicked = Game.World.hmMaterial(m_MouseHoveringLocation.xz());

This crashes.

Anything I'm forgetting?
Thanks!
04-04-2013 11:13 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: hmMaterial problem
Hi,

I've just tested this code:
MaterialPtr clicked = Game.World.hmMaterial(m_MouseHoveringLocation.xz());

and it does not crash.
remember that it can return NULL and doing "clicked->member" will cause crash

world area hmMaterial support for 2.0 was added since 28th February 2013. If you've created your world before that it will return NULL always. To fix that you can apply small change to material for each world area, and they will get resaved with correct hmMaterial information.
04-04-2013 01:04 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #3
RE: hmMaterial problem
My world was indeed from before 28th of February, changing the area material solved the problem.

Thanks a lot! grin
04-04-2013 04:45 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #4
RE: hmMaterial problem
Hi and happy New Year smile

can somebody tell me where i can set the user_type value for the materials in the editor?
I am using EE2.

Thanks,
Oliver
01-02-2014 10:53 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: hmMaterial problem
Hi, custom user_type in EE 2.0 is not yet supported.
Thank you
01-03-2014 10:51 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #6
RE: hmMaterial problem
Hi, thanks for the info.
Any other way to get different sounds on grass and concrete in ee2?

thanks,
Oliver
01-03-2014 11:14 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: hmMaterial problem
Hi,

I've added setting user_type to the roadmap smile

For the moment you could manually set user_type of few materials on app startup in the codes
01-04-2014 12:18 AM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #8
RE: hmMaterial problem
Hi,

thats fine and thank you. Setting by code is my current approach.

bye,
Oliver
01-04-2014 08:03 PM
Find all posts by this user Quote this message in a reply
Post Reply