CastRay for Terrain Material help?
by Kirchgessner · in Torque 3D Professional · 01/10/2011 (11:01 pm) · 3 replies
Ok, hopefully this won't be as confusing as it sounds.
I added into the CastRay the functionality to access the TerrainMaterial, what I want to do is to access a bool modifier I made inside the TerrainMaterial.cpp called slush. Once the player hits this "slush" I'm trying to get it to slow him down, by an integer I put in to the TerrainMaterial.
this is somewhat my code right now.
Now this code works, until I try to actually start messing with the forces of the Player. It builds with no errors, but in-game as soon as I move it crashes.
Any help is greatly Appreciated.
Thanks again.
I added into the CastRay the functionality to access the TerrainMaterial, what I want to do is to access a bool modifier I made inside the TerrainMaterial.cpp called slush. Once the player hits this "slush" I'm trying to get it to slow him down, by an integer I put in to the TerrainMaterial.
this is somewhat my code right now.
if(getContainer()->castRay(delta.pos, Point3F(delta.pos.x, delta.pos.y, delta.pos.z - 2), TerrainObjectType, &TerrCol))
{
if(TerrCol.TerrMat->slush)
{
//Make the slush slow me down
}
}Now this code works, until I try to actually start messing with the forces of the Player. It builds with no errors, but in-game as soon as I move it crashes.
Any help is greatly Appreciated.
Thanks again.
#2
01/17/2011 (10:08 pm)
While this isnt a direct help to solve your problem. As fasr as i know there is already a system in place where you can use water as almost any kind of non solid terrain type, and it has callbacks to tell the player object what type of 'liquid' you are in. I'm hoping to use this system to create varying swamp depths and speeds of swamp
#3
Thanks Bloodknight
01/17/2011 (11:55 pm)
Actually, that helps greatly, you gave me a fantastic idea.Thanks Bloodknight
Torque Owner Kirchgessner
Prosimian Productions
Still no luck even after experimenting with it for a while now.