Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added collision with ground (z=0 plane) using patch #2929553 from RAZOR

  • Loading branch information...
commit 0e620ebd029371cc888fabb83382b4bf71eaff74 1 parent 1b5f6ea
rtv authored
Showing with 13 additions and 0 deletions.
  1. +5 −0 libstage/block.cc
  2. +7 −0 libstage/world.cc
  3. +1 −0  worlds/fasr.world
View
5 libstage/block.cc
@@ -163,6 +163,10 @@ Model* Block::TestCollision()
GenerateCandidateCells();
if( mod->vis.obstacle_return )
+ {
+ if ( global_z.min < 0 )
+ return this->mod->world->GetGround();
+
// for every cell we may be rendered into
FOR_EACH( cell_it, *candidate_cells )
{
@@ -187,6 +191,7 @@ Model* Block::TestCollision()
}
}
}
+ }
//printf( "model %s block %p collision done. no hits.\n", mod->Token(), this );
return NULL; // no hit
View
7 libstage/world.cc
@@ -146,11 +146,18 @@ World::World( const std::string& name,
pthread_cond_init( &threads_done_cond, NULL );
World::world_set.insert( this );
+
+ ground = new Model(this, NULL, "model");
+ assert(ground);
+ ground->SetToken( "_ground_model" ); // allow users to identify this unique model
+ ground->ClearBlocks();
+ ground->SetGuiMove(false);
}
World::~World( void )
{
PRINT_DEBUG2( "destroying world %d %s", id, token.c_str() );
+ if( ground ) delete ground;
if( wf ) delete wf;
World::world_set.erase( this );
}
View
1  worlds/fasr.world
@@ -1,3 +1,4 @@
+
# FASR demo world
# Authors: Richard Vaughan
# $Id: fasr.world,v 1.4 2008-04-01 23:57:41 rtv Exp $
Please sign in to comment.
Something went wrong with that request. Please try again.