Game Development Community

Disallow Water Travel?

by Nicolai Dutka · in Torque Game Engine · 09/14/2007 (2:33 pm) · 12 replies

I was wondering if there is a fast way to tell the engine to "not allow players in the water" without putting blocking volumes around everything?

#1
09/14/2007 (2:54 pm)
You could use the script callback onEnterLiquid and an impulse to push the player out of the water.

Or set the waterblock 'Viscosity' high, to make the player move slower in water, to the point that it is annoyingly slow.
#2
09/14/2007 (2:57 pm)
I think the onEnterLiquid sounds like what I need. I might be switching the character out with a boat if they have one and hit the water, otherwise, force them back. Thanks!
#3
09/14/2007 (4:40 pm)
I played around with some things and decided that all the extra work in hand placing "invisible walls" as blocking volumes is giving me the best results.


Note for anyone that is trying this:

I have 2 objects, one box and one cylinder, both have a 100% transparent texture and a collision (i did "use copy of mesh"). I line up all my boxes as walls along the edges of cliffs and water and where ever I have 2 boxes meet up, I add the cylinder as a "connector" piece to prevent clipping. This is REALLY helpful!
#4
09/14/2007 (6:12 pm)
Ok, I totally forgot, but even though these are invisible, they still leave shadows. I went into their properties and unchecked everything related to lighting and then did a full relight, but the shadows are still there.

I tried changing all the invisible walls to physicis volumes with a -1 velocity mod and seemed to work well, but every spot where I have 2 physics volumes overlapped, the player can wiggle and force his way between the two, even if they overlap by 10meters....

Wtf?

How am I supposed to stop the player from going in water and jumping off cliffs over an entire planet if the walls show shadows and the volumes let the players squeeze between them?
#5
09/14/2007 (6:14 pm)
I just learned that the physics volume lets you through even with a -1 velocity mod.

If you run up against it and continue pushing up against it, it will eventually stop pushing you back and then let's you in and suddenly, you pop right through. Everytime...

So now wtf?
#6
09/14/2007 (6:21 pm)
Retool your "invisible walls" (as in your message at Sep 14, 2007 16:40 above), but use a tinny little one poly plane for the actual shape mesh, keeping the collision mesh large.
#7
09/14/2007 (8:01 pm)
I actually went back in to my max file and deleted the mesh altogether, leaving only the collision mesh and bounding box, exported that, and poof! Bye-bye shadows! :D

(I had to use the "old" exporter and export "whole shape")
#8
09/14/2007 (8:04 pm)
Oh neat, i never tried that...
#9
09/14/2007 (9:54 pm)
Ya well, after saving the mission, exiting, and reloading the mission, suddenly there are shadows in there.

I think it has to be using the collision box to make the shadows because these dts shapes don't have a textured mesh at all. They are only a collision mesh with a bounds box....

So now I am back at square one... any ideas?
#10
09/14/2007 (10:18 pm)
I still can't figure this out. Why doesn't Torque simply have a "blocking volume"? I don't want any physics to happen other than stopping the character dead in their tracks. And I certainly do NOT want any shadows....
#11
09/14/2007 (10:41 pm)
Here is an invisible DIF for you to try out. It is completely invisible except for a tiny block with a standard texture in one corner (it would crash Torque if I only used a null texture). It is completely invisible if you place the small little corner under the terrain, and it is great in first person.

Here's the problem with this: in third person when your character comes up against it, the shadow will be cast on the surface of the invisible object. There is a way around it but it involves a lot of work by integrating the transparent dif resource (if you decide to go that way and can't find it, let me know, I should have it bookmarked somewhere).

That's as close to a solution I can think of off the top of my head, oh and the file:

www.reallyreallygoodthings.com/screens/invisibleWALL.zip

Anyway, good luck!
- Alan
#12
09/14/2007 (10:47 pm)
I found a sort of... workaround.

I place all of my invisible walls (plain box with a collision mesh ('use copy of mesh') and a bounding box but textured mesh deleted).

Once ALL of them are in place, save the mission, exit Torque.

Copy the mission file. Name it whatever I want.

Open Torque, open my original mission. Delete ALL invisible walls, Full Relight the world, save, exit Torque.

Open the Back Up copy of the mission file, , .

Open the Original Mission file, , . (I just pasted ALL my invisible walls back into the world, but AFTER the world was re-lit.)

Delete the backup mission, open Torque, run my mission. All my shapes are there, no shadows! This is because shadows are saved to the *.ter file, NOT the *.mis file.

I tried open various files and coming back to this one both in editor mode and game mode and the shadows stayed gone. I loaded about 12 different times under various circumstances (using console, script, etc)