Previous Blog Next Blog
Prev/Next Blog
by date

DayOfWar Interior Portal Render Test

DayOfWar Interior Portal Render Test
Name:Bill Vee 
Date Posted:Jan 27, 2008
Rating:4.3 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Bill Vee

Blog post
This is kind of a justification to my earlier pain killer induced blog/rant about portals.

What I needed was to have interiors with large open doors with most of the interior to be in or under the terrain for hanger type structure. The problem as many know is the terrain will render inside of the interior if viewed from outside the interior looking in and ruin the effect. After searching the site for an answer I finally settled on this.
This video is a small test I created to show it off.

Now that fixes the appearance but objects will still collide with the terrain.
Not a problem.
Consider the following code

datablock TriggerData(TerrainMaskTrigger)
{
// The period is value is used to control how often the console
// onTriggerTick callback is called while there are any objects
// in the trigger. The default value is 100 MS.
tickPeriodMS = 100; // 1 Sec
};

function TerrainMaskTrigger::onEnterTrigger(%this,%trigger,%obj)
{
Parent::onEnterTrigger(%this,%trigger,%obj);
error("%con1.className= "@%obj.getClassName());
if(%obj.getClassName() $= "Player" | %obj.getClassName() $= "FlyingVehicle")
{
%obj.setMaskNoTerrain();
}
}

function TerrainMaskTrigger::onLeaveTrigger(%this,%trigger,%obj)
{
Parent::onEnterTrigger(%this,%trigger,%obj);
if(%obj.getClassName() $= "Player" | %obj.getClassName() $= "FlyingVehicle")
{
%obj.setMaskNormal();
}
}


This is the script for a trigger that basically changes the collisionmask to remove the legacy and atlas terrains from the mask.
Arrange the trigger around the terrian inside the interior and as the player steps into the trigger it "turns" off terrain collision and when it leaves it "turns" it back on.

The setMaskNoTerrain and setMaskNormal function are ConsoleMethods added to the the player and FlyingVehicle classes that handle the turning off and on of the terrain collision.

Some more work is needed but you get the idea.

If the community finds this useful I could post a resource for it.

Recent Blog Posts
List:05/31/08 - DayOfWar Six Degrees Of Freedom Camera System
05/26/08 - DayOfWar Player Controls
05/08/08 - DayOfWar more Asteroids
05/05/08 - DayOfWar Moons/Asteroids
04/28/08 - DayOfWar Oceans
04/07/08 - DayOfWar SixSidedSpheres 2nd try
04/07/08 - DayOfWar SixSidedSpheres
02/22/08 - DayOfWar is a Finalist.

Submit ResourceSubmit your own resources!

Francis   (Jan 27, 2008 at 22:35 GMT)
man that smaller passage had me thinking "how will players fit in there". Until the player was atthe other end and then i was like "ohh so that big pipe is actualy bloody huge". Nice job with the interiors!

Andrew Brady   (Jan 27, 2008 at 23:58 GMT)
I think a resource would be great!

Dave Young   (Jan 28, 2008 at 00:34 GMT)
Wow, neat solution!

Johnny Hill   (Jan 28, 2008 at 02:47 GMT)
Now that is some nice looking code fixing. I second the request for a code resource for this. dont know why but I believe some very awarkward design problems just got 90% wipe out. Dif type caves that fit a bit more snugly then they do now. The dungeon pack places dts rocks around the entrance. But with this you dont need the extra hide the horrible gap stuff to make a nice entrance.

Will Zettler   (Jan 28, 2008 at 03:43 GMT)   Resource Rating: 3
Bill:

I'm with Andrew on this... looks sharp and yes it should be released to help us better understand the engine. Looking forward to more of your tips... keep it up.

Will
dlstorminc@yahoo.com
Waskom, Tx

Ben Sparks (Warspawn)   (Jan 28, 2008 at 16:03 GMT)   Resource Rating: 5
I would love this as a resource, one of the biggest "problems" with using atlas is that you can't cut holes in the terrain like you can with legacy, this would really really help! Thanks.

Ben Acord   (Jan 28, 2008 at 19:20 GMT)   Resource Rating: 5
You've got my vote for resource.

Bill Vee   (Jan 29, 2008 at 15:32 GMT)
I will clean the code up a little and post a resource as soon as I can.
I needed one more feature added so I am currently coding it to take a "stencil" texture to be used for irregular shaped openings.

Just so everyone knows this is a TGEA solution.
If I could figure out how to do a render-to-texture in TGE I would post a resource for that.

Mikael Pettersson   (Jan 30, 2008 at 05:39 GMT)
I got a question ... Does projectiles still collide with the terrain if fired from within/outside the trigger/portal?

Bill Vee   (Jan 30, 2008 at 13:22 GMT)
@Mikael Yes they do but I just about have that solved by making projectiles trigger "aware".
It kinda works now but high speed projectiles are hitting the the terrain before the trigger event.
The solution will have to be another resource. I am experimenting with ray casting before firing the projectiles to see if terrain collision can be turned off there.

Mikael Pettersson   (Jan 31, 2008 at 06:32 GMT)
ok.
Well .. i dropped you a mail last night about helping out with a website for you ... i will await your reply.

Bill Vee   (Jan 31, 2008 at 12:59 GMT)
Ok just about done with the resource. I got projectiles playing nice with triggers now.

Didn't realize until last night that it is 3 separate resources.

1. Terrain occluding portal.
2. Trigger aware projectiles.
3. Script changeable collision masks.

I think I will post it as one resource for now since the desired effect is to be able to look into an interior from the outside and not see the terrain as well as shoot into it and the projectile not hit the terrain and for player/vehicles to go into it and not collide with the terrain.

I still have a little coding left on the portal to do. Just to clean it up a little, it is based off the waterblock code and I need to remove a lot of stuff not related to the portal.
I should be able to post it by this weekend.

@Mikael I sent you a reply.

Bill Vee   (Feb 09, 2008 at 07:07 GMT)
Sorry for the delay.
I just finished my demo for the instantaction contest and its 1:00AM now.
I need some sleep. I will try and finish the resource as soon as I can.

Bill Vee   (Feb 10, 2008 at 22:21 GMT)
Ok the resource is done.

It hasn't been approved yet but the link is here
Edited on Feb 10, 2008 22:22 GMT

You must be a member and be logged in to either append comments or rate this resource.