Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 0e620ebd029371cc888fabb83382b4bf71eaff74 1 parent 1b5f6ea
rtv authored
5 libstage/block.cc
@@ -163,6 +163,10 @@ Model* Block::TestCollision()
163 163 GenerateCandidateCells();
164 164
165 165 if( mod->vis.obstacle_return )
  166 + {
  167 + if ( global_z.min < 0 )
  168 + return this->mod->world->GetGround();
  169 +
166 170 // for every cell we may be rendered into
167 171 FOR_EACH( cell_it, *candidate_cells )
168 172 {
@@ -187,6 +191,7 @@ Model* Block::TestCollision()
187 191 }
188 192 }
189 193 }
  194 + }
190 195
191 196 //printf( "model %s block %p collision done. no hits.\n", mod->Token(), this );
192 197 return NULL; // no hit
7 libstage/world.cc
@@ -146,11 +146,18 @@ World::World( const std::string& name,
146 146 pthread_cond_init( &threads_done_cond, NULL );
147 147
148 148 World::world_set.insert( this );
  149 +
  150 + ground = new Model(this, NULL, "model");
  151 + assert(ground);
  152 + ground->SetToken( "_ground_model" ); // allow users to identify this unique model
  153 + ground->ClearBlocks();
  154 + ground->SetGuiMove(false);
149 155 }
150 156
151 157 World::~World( void )
152 158 {
153 159 PRINT_DEBUG2( "destroying world %d %s", id, token.c_str() );
  160 + if( ground ) delete ground;
154 161 if( wf ) delete wf;
155 162 World::world_set.erase( this );
156 163 }
1  worlds/fasr.world
... ... @@ -1,3 +1,4 @@
  1 +
1 2 # FASR demo world
2 3 # Authors: Richard Vaughan
3 4 # $Id: fasr.world,v 1.4 2008-04-01 23:57:41 rtv Exp $

0 comments on commit 0e620eb

Please sign in to comment.
Something went wrong with that request. Please try again.