-
Notifications
You must be signed in to change notification settings - Fork 61
Accessing Terrain Features
Neo-X edited this page Feb 13, 2018
·
1 revision
Accessing the underlying simulator in order to compute things such as a local heightmap of the terrain can be done simply. However, adding additional features can be more complex.
cTerrainRLCharController holds the pointer to the ground. With the ground the hight can be sampled at any particular position.
double h = mGround->SampleHeight(pos);
bool cTerrainRLCharController::SampleGroundHeightVel(const tVector& pos, double& out_h, tVector& out_vel) const
{
bool valid_sample = false;
out_h = 0;
out_vel.setZero();
if (mGround != nullptr)
{
mGround->SampleHeightVel(pos, out_h, out_vel, valid_sample);
}
return valid_sample;
}
This should end up calling a method in the class cGroundDynamicObstacles3D that will see if the location intersects with an obstacle. if it does it will return the object velocity.
Note: The ground is given to the controller when it is created in cTerrainRLCtrlFactory