Boating with TGEA water - water physics?
by Vashner · in Torque Game Engine Advanced · 11/24/2006 (2:22 pm) · 7 replies
I did a search but didn't find anything so please forgive if it's been asked.
Looking for any information on how to mount a boat with TGEA's shaded water system.
Looking for any information on how to mount a boat with TGEA's shaded water system.
#2
11/26/2006 (12:31 pm)
In our game, we just check if the boat is going to be below the surface on the next tick, and if it is true, we push the boat in the direction of the water (since it can be rotated in TGEA) much like players walk on interiors or terrain.
#3
I guess this is the place to start? Any other pointers / links etc would be great.
Finney's TGE boat resource
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2299
11/26/2006 (3:28 pm)
Thanks that should help point me in the right direction. So it acts just like TGE water in the fact that it can check for value of below/at/above water surface?I guess this is the place to start? Any other pointers / links etc would be great.
Finney's TGE boat resource
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2299
#4
I modified the pointinwater so it looked like this:
So then doing something like this:
Would check to see if the player was underwater.
11/26/2006 (5:12 pm)
The old TGE functions weren't ported over it seems. Neither were the imagestates for iswet etc. For player swimming I also used the invisible dif approach, but needed to see if a player was beyond their waist in the water so that I could use a swimming animation and slow down movement. I modified the pointinwater so it looked like this:
bool Player::pointInWater( Point3F &point )
{
SimpleQueryList sql;
if (isServerObject())
gServerSceneGraph->getWaterObjectList(sql);
else
gClientSceneGraph->getWaterObjectList(sql);
for (U32 i = 0; i < sql.mList.size(); i++)
{
WaterBlock* pBlock = dynamic_cast<WaterBlock*>(sql.mList[i]);
// if (pBlock && pBlock->getLiquidType() == WaterBlock::eWater )
// if (pBlock)
// {
if (pBlock->isUnderwater( point ))
{
return true;
}
// }
}
return false;
}So then doing something like this:
Point3F curPos = getPosition();
if (pointInWater( Point3F(curPos.x, curPos.y, (curPos.z + 1.0f) )))
Con::printf("We ARE Swimming");
else
Con::printf("We Are NOT Swimming");Would check to see if the player was underwater.
#5
Would be nice if someone made a TGEA Boat Pack. I would pay $100-200 for something like that.
11/29/2006 (7:56 am)
Thanks for the nfoWould be nice if someone made a TGEA Boat Pack. I would pay $100-200 for something like that.
#6
A boat pack would definatly be cool, though.
11/29/2006 (8:12 am)
The "pointBelowWater" stuff is just a regular box overlap check. Porting over those functions is a matter of 5 minutes tops.A boat pack would definatly be cool, though.
#7
That should be a whole nother post I suppose.
11/29/2006 (11:51 am)
Another thing that would be nice is tide / wave via Z axis movement of the waterblock.That should be a whole nother post I suppose.
Torque 3D Owner J.C. Smith
To mount it would be the same as TGEA. At it's simplest...
But by the title I'm guessing your referring to how you could make the boat work on the TGEA water. None of the waterblock physics or water checks actually work, unfortunately. I implemented boats into AOM but I faked it. I created a flat DIF which I put under the water at the level I wanted the boat to float in, and I made the DIF fully transparent so you couldn't see it. I then put vehicleblockers on the edges of the water, so that when a vehicle ran "aground" that it would push it back towards the water.
It was far from a perfect solution, but in our case it worked good enough for what we needed to have done. In your case it sounds like you should probably expect to need some major modifications.