OpenBF1942-Plus
Refractor 1, rebuilt from scratch
Loading...
Searching...
No Matches
obf::Physics Class Reference

#include <physics.h>

Classes

struct  Hit
struct  Impl

Public Member Functions

 Physics (const Heightmap &hm, float world_size, float water_level=-1e9f)
 ~Physics ()
size_t add_scene (const std::vector< DrawItem > &items, const Vfs &vfs, const std::set< std::string > &ladders={})
void add_ladder (const float lo[3], const float hi[3])
size_t ladders () const
void add_static (const std::string &key, const CollisionMesh &mesh, const Mat4 &world)
int add_vehicle (const VehicleDef &def, const Mat4 &world)
void drive (int vehicle, float throttle, float yaw, float pitch=0, float roll=0)
void set_velocity (int vehicle, float x, float y, float z)
void look (int vehicle, float x, float y, int seat=0)
Mat4 joint (int vehicle, const std::string &name, int occurrence) const
void step (float dt)
Mat4 transform (int vehicle) const
float speed (int vehicle) const
int fire (const float pos[3], const float vel[3], int material, int material2, float ttl, int ignore_vehicle=-1, int ignore_character=-1, int tag=0, float radius=0, bool bounce=false)
bool shot_position (int id, float out[3]) const
void explode (int id)
std::vector< Hit > take_hits ()
bool line_of_sight (const float a[3], const float b[3], int ignore_character, int target_character, int target_vehicle, int ignore_vehicle=-1) const
void projectiles (std::vector< float > &out) const
void projectile_ids (std::vector< int > &out) const
int add_character (float x, float y, float z)
void walk (int character, float vx, float vz, bool jump)
void place_character (int character, float x, float y, float z)
void set_character_active (int character, bool active)
void kill_character (int character)
void character_position (int character, float out[3]) const
bool set_posture (int character, int posture)
void open_parachute (int character, float k)
bool parachute_open (int character) const
float take_landing (int character)
void character_steps (int character, unsigned &jumps, unsigned &landings) const
bool character_swimming (int character) const
bool character_climbing (int character) const
int character_ladder (int character) const
bool character_on_ground (int character) const

Constructor & Destructor Documentation

◆ Physics()

obf::Physics::Physics ( const Heightmap & hm,
float world_size,
float water_level = -1e9f )

◆ ~Physics()

obf::Physics::~Physics ( )
default

Member Function Documentation

◆ add_character()

int obf::Physics::add_character ( float x,
float y,
float z )

◆ add_ladder()

void obf::Physics::add_ladder ( const float lo[3],
const float hi[3] )

◆ add_scene()

size_t obf::Physics::add_scene ( const std::vector< DrawItem > & items,
const Vfs & vfs,
const std::set< std::string > & ladders = {} )

◆ add_static()

void obf::Physics::add_static ( const std::string & key,
const CollisionMesh & mesh,
const Mat4 & world )

◆ add_vehicle()

int obf::Physics::add_vehicle ( const VehicleDef & def,
const Mat4 & world )

◆ character_climbing()

bool obf::Physics::character_climbing ( int character) const

◆ character_ladder()

int obf::Physics::character_ladder ( int character) const

◆ character_on_ground()

bool obf::Physics::character_on_ground ( int character) const

◆ character_position()

void obf::Physics::character_position ( int character,
float out[3] ) const

◆ character_steps()

void obf::Physics::character_steps ( int character,
unsigned & jumps,
unsigned & landings ) const

◆ character_swimming()

bool obf::Physics::character_swimming ( int character) const

◆ drive()

void obf::Physics::drive ( int vehicle,
float throttle,
float yaw,
float pitch = 0,
float roll = 0 )

◆ explode()

void obf::Physics::explode ( int id)

◆ fire()

int obf::Physics::fire ( const float pos[3],
const float vel[3],
int material,
int material2,
float ttl,
int ignore_vehicle = -1,
int ignore_character = -1,
int tag = 0,
float radius = 0,
bool bounce = false )

◆ joint()

Mat4 obf::Physics::joint ( int vehicle,
const std::string & name,
int occurrence ) const

◆ kill_character()

void obf::Physics::kill_character ( int character)

◆ ladders()

size_t obf::Physics::ladders ( ) const

◆ line_of_sight()

bool obf::Physics::line_of_sight ( const float a[3],
const float b[3],
int ignore_character,
int target_character,
int target_vehicle,
int ignore_vehicle = -1 ) const

◆ look()

void obf::Physics::look ( int vehicle,
float x,
float y,
int seat = 0 )

◆ open_parachute()

void obf::Physics::open_parachute ( int character,
float k )

◆ parachute_open()

bool obf::Physics::parachute_open ( int character) const

◆ place_character()

void obf::Physics::place_character ( int character,
float x,
float y,
float z )

◆ projectile_ids()

void obf::Physics::projectile_ids ( std::vector< int > & out) const

◆ projectiles()

void obf::Physics::projectiles ( std::vector< float > & out) const

◆ set_character_active()

void obf::Physics::set_character_active ( int character,
bool active )

◆ set_posture()

bool obf::Physics::set_posture ( int character,
int posture )

◆ set_velocity()

void obf::Physics::set_velocity ( int vehicle,
float x,
float y,
float z )

◆ shot_position()

bool obf::Physics::shot_position ( int id,
float out[3] ) const

◆ speed()

float obf::Physics::speed ( int vehicle) const

◆ step()

void obf::Physics::step ( float dt)

◆ take_hits()

std::vector< Physics::Hit > obf::Physics::take_hits ( )

◆ take_landing()

float obf::Physics::take_landing ( int character)

◆ transform()

Mat4 obf::Physics::transform ( int vehicle) const

◆ walk()

void obf::Physics::walk ( int character,
float vx,
float vz,
bool jump )

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