SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
TerrainInfo Class Reference

This class stores information about the triangle that's under an object, i.e.: the normal, a pointer to the material, and the height above th. More...

#include <terrain_info.hpp>

Inheritance diagram for TerrainInfo:
Inheritance graph
[legend]

Public Member Functions

 TerrainInfo ()
 Constructor to initialise terrain data.
 
 TerrainInfo (const Vec3 &pos)
 Constructor to initialise terrain data at a given position.
 
bool getSurfaceInfo (const Vec3 &from, Vec3 *position, const Material **m)
 Does a raycast upwards from the given position If the raycast indicated that the kart is 'under something' (i.e.
 
virtual void update (const btMatrix3x3 &rotation, const Vec3 &from)
 Update the terrain information based on the latest position.
 
virtual void update (const Vec3 &from)
 Update the terrain information based on the latest position.
 
virtual void update (const Vec3 &from, const Vec3 &towards)
 Update the terrain information based on the latest position.
 
virtual void update (const btMatrix3x3 &rotation)
 Simple wrapper with no offset.
 
float getHoT () const
 Returns the height of the terrain.
 
const MaterialgetMaterial () const
 Returns the current material the kart is on.
 
const MaterialgetLastMaterial () const
 Returns the previous material the kart was one (which might be the same as getMaterial() ).
 
const Vec3getNormal () const
 Returns the normal of the terrain the kart is on.
 
float getTerrainPitch (float heading) const
 Returns the pitch of the terrain depending on the heading.
 
const btVector3 & getHitPoint () const
 Returns the hit point of the raycast.
 
const Vec3getOrigin () const
 

Private Attributes

Vec3 m_normal
 Normal of the triangle under the object.
 
const Materialm_material
 Material of the triangle under the object.
 
const Materialm_last_material
 The previous material a kart was on.
 
Vec3 m_hit_point
 The point that was hit.
 
Vec3 m_origin_ray
 DEBUG only: origin of raycast.
 

Detailed Description

This class stores information about the triangle that's under an object, i.e.: the normal, a pointer to the material, and the height above th.

Constructor & Destructor Documentation

◆ TerrainInfo()

TerrainInfo::TerrainInfo ( const Vec3 pos)

Constructor to initialise terrain data at a given position.

Parameters
posThe position to get the data from.

Member Function Documentation

◆ getHoT()

float TerrainInfo::getHoT ( ) const
inline

Returns the height of the terrain.

we're currently above

◆ getSurfaceInfo()

bool TerrainInfo::getSurfaceInfo ( const Vec3 from,
Vec3 position,
const Material **  material 
)

Does a raycast upwards from the given position If the raycast indicated that the kart is 'under something' (i.e.

a specially marked terrain), to another raycast up to detect under whic mesh the kart is. This is using the special gfx effect mesh only. This is used e.g. to detect if a kart is under water, and then to get the proper position for water effects. Note that the TerrainInfo objects keeps track of the previous raycast position.

◆ update() [1/3]

void TerrainInfo::update ( const btMatrix3x3 &  rotation,
const Vec3 from 
)
virtual

Update the terrain information based on the latest position.

Parameters
tranThe transform ov the kart
fromWorld coordinates from which to start the raycast.

◆ update() [2/3]

void TerrainInfo::update ( const Vec3 from)
virtual

Update the terrain information based on the latest position.

Parameters
Positionfrom which to start the raycast from.

◆ update() [3/3]

void TerrainInfo::update ( const Vec3 from,
const Vec3 towards 
)
virtual

Update the terrain information based on the latest position.

Parameters
Positionfrom which to start the rayast from.

The documentation for this class was generated from the following files: