Game Development Community

WaterBlock::onAdd Crash

by Kirk Haynes · in Torque Game Engine Advanced · 03/20/2007 (11:04 am) · 7 replies

In WaterBlock::onAdd starting on line 86:

mMaterial[i] = static_cast(Sim::findObject( mSurfMatName[i] ));
mMaterial[i]->setStageData();

mMaterial[i] can be 0 and crashes on call to setStageData();

#1
03/22/2007 (6:32 am)
Maybe I'm saying something very stupid but...
Are you adding the waterblock with its default parameters?
I was having TGEA crashing when adding a waterblock with the default parameters... then just copied the data/water folder from TerrainWaterDemo to data/water folder in my mod and solved since the default parameters reference some files present in this dir...
Anyway now it doesn't crash but I've not yet the water surface effect, I'm trying to figure out why...
JoZ.
#2
03/22/2007 (7:29 am)
Your material does not exist or the material specified is not a material. If you change the static_cast into a dynamic_cast and check for -1 afterwards, you can catch the crash and print out the className.
#3
03/23/2007 (8:49 am)
Yes. The materials weren't defined properly and that caused the crash. Just noting it because it should be an assert at least to prevent the crash.
#4
03/26/2007 (12:56 pm)
Ya, that's already been fixed for 1.01.
#5
03/26/2007 (1:20 pm)
Hi brian, tnx for the reply...
I've seen that on the demo page the download points to vers. 1.01 but in my account page I still having a link pointing to vers. 1.0 of full vers...

A mistake or 1.01 full is not yet been released?

Tnx,
JoZ
#6
03/28/2007 (3:36 pm)
1.01 isnt' out for the SDK. It's not quite the same thing either, a new demo was put out so that it didn't crash if you had an older version of DirectX installed.
#7
03/28/2007 (3:46 pm)
Tnx ;)

Solved, if someone wanna take a look at how now looks my first mission... my TGEA blog

JoZ