MAterial Mapping
by Ronald J Nelson · in Torque Game Engine · 06/07/2006 (4:57 pm) · 4 replies
Can someone tell me how to access the material mapping functions from script so I can get material specific information upon collision?
#2
06/08/2006 (12:19 am)
Oh yeah been working with it just wondering if anyone had gotten further along on this.
#3
MaterialPropertyMap* pMatMap = static_cast(Sim::findObject("MaterialPropertyMap"));
const MaterialPropertyMap::MapEntry* pEntry = pMatMap->getMapEntryFromIndex(rInfo.material);
pMatType = pEntry->matType;
I know this has been used before in other places but I dont under stand why the use of either a static_cast or dynamic_cast towards a terrain object crashes my system. As I said before it works perfectly with every other object type.
06/09/2006 (10:45 am)
Well I am almost totally successful in my code except for one very big problem. Shoot a bullet at anything but the terrain and it does exactly what it should. Shoot at the terrain and the game crashes. I now where the problem stems from but I am not sure why. In projectile.cc in the proccesstick function I added this right before the oncollision and explode call:MaterialPropertyMap* pMatMap = static_cast
const MaterialPropertyMap::MapEntry* pEntry = pMatMap->getMapEntryFromIndex(rInfo.material);
pMatType = pEntry->matType;
I know this has been used before in other places but I dont under stand why the use of either a static_cast or dynamic_cast towards a terrain object crashes my system. As I said before it works perfectly with every other object type.
#4
06/09/2006 (12:16 pm)
Well I got past that point. I will likely look at releasing this after I knock out some more bugs.
Torque Owner Alberto Ganesh Barbati
Default Studio Name