Code first:
Code: Select all
UModel* Model = XLevel->Model;
FBspNode Node = Model->Nodes(Res->Item);
FBspSurf Surf = Model->Surfs(Node.iSurf);
// Coplanar FBspNodes
if ( Node.iPlane != INDEX_NONE )
{
GLog->Logf( TEXT("Warning: Node.iPlane != INDEX_NONE") );
TArray<FName> CoNames;
for ( FBspNode Current = Model->Nodes(Res->Item); Model->Nodes.IsValidIndex( Current.iPlane ); Current = Model->Nodes( Current.iPlane ) )
{
FBspSurf CurrentSurf = Model->Surfs(Current.iSurf);
CoNames.AddUniqueItem( CurrentSurf.Texture ? CurrentSurf.Texture->GetFName() : NAME_None );
}
GLog->Logf( TEXT("CoNames.Num() = %i"), CoNames.Num() );
for ( INT i = 0; i < CoNames.Num(); i++ )
GLog->Logf( TEXT("CoNames(%i) = %s"), i, *CoNames(i) );
}
// Childs
if ( Node.iFront != INDEX_NONE )
{
GLog->Logf( TEXT("Warning: Node.iFront != INDEX_NONE") );
}
if ( Node.iBack != INDEX_NONE )
{
GLog->Logf( TEXT("Warning: Node.iBack != INDEX_NONE") );
}
Okay, i checked the iSurf thing.. however for maggie chans appartment the *real* texture appeared in the lists:
TraceTexture: ----[TraceTextureHan]-----------------------------------------------
Log: Warning: Node.iPlane != INDEX_NONE
Log: CoNames.Num() = 4
Log: CoNames(0) = HexagonTile
Log: CoNames(1) = FlwrCrptPatrn_A
Log: CoNames(2) = floor3
Log: CoNames(3) = floor2
Log: Warning: Node.iFront != INDEX_NONE
Log: Warning: Node.iBack != INDEX_NONE
TraceTexture: Target = 06_HongKong_WanChai_Street.LevelInfo0 ,TexName = HexagonTile TexGroup = Metal TexFlags = 0
TraceTexture: ======================================================================
HexagonTile is the tile which makes the metal sound, and FlwrCrptPatrn_A is the texture i want, so i need to find a way to find out on which bsp plane i'm standing. I have a list of points the polygon has, a normal and a player postion. This is just simple math to figure out if the straight (Player.Location + \nu * Normal) is inside the polygon (Remember, the player might stand on a surface which normal is not (0, 0, 1)!).
However, this will not be enough, if i load up WanChai Market, and walk next to the newspaper/flower stand:
TraceTexture: ----[TraceTextureHan]-----------------------------------------------
Log: Warning: Node.iPlane != INDEX_NONE
Log: CoNames.Num() = 1
Log: CoNames(0) = FlwrCrptPatrn_A
TraceTexture: Target = 06_HongKong_WanChai_Market.LevelInfo0 ,TexName = FlwrCrptPatrn_A TexGroup = Textile TexFlags = 0
TraceTexture: ======================================================================
But this should be stone sth, but it didn't even show up. However it has no iFront nor iBack to check further, so i guess there is another BSPNode which has an iPlane which points at this BSPSurf, and this is really bad, since i probably have to search *ALL* BspNodes for a reference to this one.. and the all bsp nodes for a reference to this one... this might be to slow and is ugly anyway.
However i might just need to do this when the checks for inside the polygon fail. And still with just the polygon check added this would work at least way more reliable then the old TraceTexture(). However.. i'm really supprised that the old TraceTexture() even worked that well.
/edit:
Code: Select all
INT FindTop( UModel* Model, INT InIndex )
{
for ( INT i = 0; i < Model->Nodes.Num(); i++ )
{
FBspNode Node = Model->Nodes( i );
if ( Node.iPlane == InIndex )
return FindTop( Model, i );
}
return InIndex;
}
But this doesn't seem to reveal new BspNodes. And for the critial part in the market before the news/flower stand this is also just:
TraceTexture: ----[TraceTextureHan]-----------------------------------------------
Log: TopNames.Num() = 1
Log: TopNames(0) = FlwrCrptPatrn_A
Log: Warning: Node.iPlane != INDEX_NONE
Log: CoNames.Num() = 1
Log: CoNames(0) = FlwrCrptPatrn_A
TraceTexture: Target = 06_HongKong_WanChai_Market.LevelInfo0 ,TexName = FlwrCrptPatrn_A TexGroup = Textile TexFlags = 0
TraceTexture: ======================================================================
I also found this grassstep sound near the compound there, but:
TraceTexture: ----[TraceTextureHan]-----------------------------------------------
Log: TopNames.Num() = 3
Log: TopNames(0) = LakeBed_A
Log: TopNames(1) = CermTileFloor_A
Log: TopNames(2) = HKM_Bricks_01
Log: Warning: Node.iPlane != INDEX_NONE
Log: CoNames.Num() = 3
Log: CoNames(0) = LakeBed_A
Log: CoNames(1) = CermTileFloor_A
Log: CoNames(2) = HKM_Bricks_01
Log: Warning: Node.iFront != INDEX_NONE
Log: Warning: Node.iBack != INDEX_NONE
TraceTexture: Target = 06_HongKong_WanChai_Market.LevelInfo0 ,TexName = LakeBed_A TexGroup = Earth TexFlags = 0
TraceTexture: ======================================================================
Earth makes this grass step sounds. However there is the right HKM_Bricks_01 texture, or at least i hope this is the right one, so this spot should be no issue.
/edit2:
Code: Select all
guard(TurfsList);
TArray<FName> TurfNames;
if ( Node.iSurf != INDEX_NONE )
{
for ( INT i = 0; i < Surf.Nodes.Num(); i++ )
{
INT Index = Surf.Nodes(i);
if ( Index != INDEX_NONE )
{
FBspNode CrashNode = Model->Nodes(Index);
if ( CrashNode.iSurf != INDEX_NONE )
{
FBspSurf CurrySurf = Model->Surfs(CrashNode.iSurf);
TurfNames.AddUniqueItem( CurrySurf.Texture ? CurrySurf.Texture->GetFName() : NAME_None );
}
}
}
GLog->Logf( TEXT("TurfNames.Num() = %i"), TurfNames.Num() );
for ( i = 0; i < TurfNames.Num(); i++ )
GLog->Logf( TEXT("TurfNames(%i) = %s"), i, *TurfNames(i) );
}
unguard;
Using the Surfs Nodes list won't help. It will return less textures and even skip the right one:
Code: Select all
TraceTexture: ----[TraceTextureHan]-----------------------------------------------
Log: TurfNames.Num() = 1
Log: TurfNames(0) = LakeBed_A
Log: TopNames.Num() = 3
Log: TopNames(0) = LakeBed_A
Log: TopNames(1) = CermTileFloor_A
Log: TopNames(2) = HKM_Bricks_01
Log: Warning: Node.iPlane != INDEX_NONE
Log: CoNames.Num() = 3
Log: CoNames(0) = LakeBed_A
Log: CoNames(1) = CermTileFloor_A
Log: CoNames(2) = HKM_Bricks_01
Log: Warning: Node.iFront != INDEX_NONE
Log: Warning: Node.iBack != INDEX_NONE
TraceTexture: Target = 06_HongKong_WanChai_Market.LevelInfo0 ,TexName = LakeBed_A TexGroup = Earth TexFlags = 0
TraceTexture: ======================================================================
TraceTexture: ----[TraceTextureHan]-----------------------------------------------
Log: TurfNames.Num() = 1
Log: TurfNames(0) = FlwrCrptPatrn_A
Log: TopNames.Num() = 1
Log: TopNames(0) = FlwrCrptPatrn_A
Log: Warning: Node.iPlane != INDEX_NONE
Log: CoNames.Num() = 1
Log: CoNames(0) = FlwrCrptPatrn_A
TraceTexture: Target = 06_HongKong_WanChai_Market.LevelInfo0 ,TexName = FlwrCrptPatrn_A TexGroup = Textile TexFlags = 0
TraceTexture: ======================================================================
So i guess this the best you can get in this approach, using SingleLineCheck() probably won't help as it is probably using MultiLineCheck() too. I guess trying out various trace flags won't help.
Code: Select all
enum ETraceActorFlags
{
// Bitflags.
TRACE_Pawns = 0x01, // Check collision with pawns.
TRACE_Movers = 0x02, // Check collision with movers.
TRACE_Level = 0x04, // Check collision with level geometry.
TRACE_ZoneChanges = 0x08, // Check collision with soft zone boundaries.
TRACE_Others = 0x10, // Check collision with all other kinds of actors.
TRACE_OnlyProjActor = 0x20, // Check collision with other actors only if they are projectile targets
// Combinations.
TRACE_VisBlocking = TRACE_Level | TRACE_Movers,
TRACE_AllColliding = TRACE_Pawns | TRACE_Movers | TRACE_Level | TRACE_Others,
TRACE_AllEverything = TRACE_Pawns | TRACE_Movers | TRACE_Level | TRACE_ZoneChanges | TRACE_Others,
TRACE_ProjTargets = TRACE_OnlyProjActor | TRACE_AllColliding,
};