![Logo](../../rorlogo.png) |
RigsofRods
Soft-body Physics Simulation
|
Go to the documentation of this file.
55 Ogre::AxisAlignedBox
aab;
70 Ogre::Vector3
scale = Ogre::Vector3::ZERO;
160 void hash_add(
int cell_x,
int cell_z,
int value,
float h);
162 unsigned int hashfunc(
unsigned int cellid);
165 Ogre::Vector3
calcCollidedSide(
const Ogre::Vector3& pos,
const Ogre::Vector3& lo,
const Ogre::Vector3& hi);
176 Ogre::Vector3
getPosition(
const Ogre::String& inst,
const Ogre::String& box);
177 Ogre::Quaternion
getDirection(
const Ogre::String& inst,
const Ogre::String& box);
184 bool collisionCorrect(Ogre::Vector3* refpos,
bool envokeScriptCallbacks =
true);
186 bool isInside(Ogre::Vector3 pos,
const Ogre::String& inst,
const Ogre::String& box,
float border = 0);
194 int addCollisionBox(
bool rotating,
bool virt, Ogre::Vector3 pos, Ogre::Vector3 rot, Ogre::Vector3 l, Ogre::Vector3 h, Ogre::Vector3 sr,
const Ogre::String& eventname,
const Ogre::String& instancename,
bool forcecam, Ogre::Vector3 campos, Ogre::Vector3 sc = Ogre::Vector3::UNIT_SCALE, Ogre::Vector3 dr = Ogre::Vector3::ZERO,
CollisionEventFilter event_filter =
EVENT_ALL,
int scripthandler = -1);
195 void addCollisionMesh(Ogre::String
const& srcname, Ogre::String
const& meshname, Ogre::Vector3
const& pos, Ogre::Quaternion
const& q, Ogre::Vector3
const& scale,
ground_model_t* gm = 0, std::vector<int>* collTris = 0);
196 void registerCollisionMesh(Ogre::String
const& srcname, Ogre::String
const& meshname, Ogre::Vector3
const& pos, Ogre::AxisAlignedBox bounding_box,
ground_model_t* gm,
int ctri_start,
int ctri_count);
212 void getMeshInformation(Ogre::Mesh* mesh,
size_t& vertex_count, Ogre::Vector3* & vertices,
213 size_t& index_count,
unsigned* & indices,
214 const Ogre::Vector3& position = Ogre::Vector3::ZERO,
215 const Ogre::Quaternion& orient = Ogre::Quaternion::IDENTITY,
const Ogre::Vector3& scale = Ogre::Vector3::UNIT_SCALE);
223 Ogre::Vector3
primitiveCollision(node_t* node, Ogre::Vector3 velocity,
float mass, Ogre::Vector3 normal,
float dt, ground_model_t* gm,
float penetration = 0);
const Ogre::Vector3 m_terrain_size
#define ROR_ASSERT(_EXPR)
void parseGroundConfig(Ogre::ConfigFile *cfg, Ogre::String groundModel="")
Softbody object; can be anything from soda can to a space shuttle Constructed from a truck definition...
Ogre::Vector3 primitiveCollision(node_t *node, Ogre::Vector3 velocity, float mass, Ogre::Vector3 normal, float dt, ground_model_t *gm, float penetration=0)
static const int MAXIMUM_CELL
bool IsCollisionBox() const
int addCollisionBox(bool rotating, bool virt, Ogre::Vector3 pos, Ogre::Vector3 rot, Ogre::Vector3 l, Ogre::Vector3 h, Ogre::Vector3 sr, const Ogre::String &eventname, const Ogre::String &instancename, bool forcecam, Ogre::Vector3 campos, Ogre::Vector3 sc=Ogre::Vector3::UNIT_SCALE, Ogre::Vector3 dr=Ogre::Vector3::ZERO, CollisionEventFilter event_filter=EVENT_ALL, int scripthandler=-1)
std::string es_instance_name
Specified by user when calling "GameScript::spawnObject()".
Records which collision triangles belong to which mesh.
float getSurfaceHeightBelow(float x, float z, float height)
ground_model_t * defaultgm
bool groundCollision(node_t *node, float dt)
void findPotentialEventBoxes(Actor *actor, CollisionBoxPtrVec &out_boxes)
static const int HASH_POWER
Ogre::AxisAlignedBox bounding_box
int element_index
Values below ELEMENT_TRI_BASE_INDEX are collision box indices (Collisions::m_collision_boxes),...
Ogre::Vector3 getPosition(const Ogre::String &inst, const Ogre::String &box)
static const int CELL_BLOCKSIZE
CollisionTriVec const & getCollisionTriangles() const
std::vector< collision_box_t * > CollisionBoxPtrVec
void registerCollisionMesh(Ogre::String const &srcname, Ogre::String const &meshname, Ogre::Vector3 const &pos, Ogre::AxisAlignedBox bounding_box, ground_model_t *gm, int ctri_start, int ctri_count)
Mark already generated collision tris as belonging to (virtual) mesh.
void addCollisionMesh(Ogre::String const &srcname, Ogre::String const &meshname, Ogre::Vector3 const &pos, Ogre::Quaternion const &q, Ogre::Vector3 const &scale, ground_model_t *gm=0, std::vector< int > *collTris=0)
generate collision tris from existing mesh resource
bool collisionCorrect(Ogre::Vector3 *refpos, bool envokeScriptCallbacks=true)
std::array< float, HASH_SIZE > hashtable_height
Ogre::Vector3 calcCollidedSide(const Ogre::Vector3 &pos, const Ogre::Vector3 &lo, const Ogre::Vector3 &hi)
void removeCollisionTri(int number)
int hash_find(int cell_x, int cell_z)
int loadGroundModelsConfigFile(Ogre::String filename)
std::pair< bool, Ogre::Real > intersectsTris(Ogre::Ray ray)
void removeCollisionBox(int number)
ground_model_t * getGroundModelByString(const Ogre::String name)
std::string es_box_name
Specified in ODEF file as "event".
Core data structures for simulation; Everything affected by by either physics, network or user intera...
Ogre::AxisAlignedBox getCollisionAAB()
void envokeScriptCallback(collision_box_t *cbox, node_t *node=0)
collision_box_t * getBox(const Ogre::String &inst, const Ogre::String &box)
Ogre::Vector3 forcecampos
ground_model_t * ground_model
int es_cbox
Collision box ID.
static const int HASH_SIZE
std::vector< collision_box_t > CollisionBoxVec
std::map< Ogre::String, ground_model_t > ground_models
int addCollisionTri(Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 p3, ground_model_t *gm)
std::vector< hash_coll_element_t > hashtable[HASH_SIZE]
Central state/object manager and communications hub.
Physics: A vertex in the softbody structure.
CollisionTriVec m_collision_tris
int es_script_handler
AngelScript function ID.
float getSurfaceHeight(float x, float z)
std::vector< collision_tri_t > CollisionTriVec
Collisions(Ogre::Vector3 terrn_size)
std::vector< collision_mesh_t > CollisionMeshVec
bool nodeCollision(node_t *node, float dt)
void getMeshInformation(Ogre::Mesh *mesh, size_t &vertex_count, Ogre::Vector3 *&vertices, size_t &index_count, unsigned *&indices, const Ogre::Vector3 &position=Ogre::Vector3::ZERO, const Ogre::Quaternion &orient=Ogre::Quaternion::IDENTITY, const Ogre::Vector3 &scale=Ogre::Vector3::UNIT_SCALE)
void createCollisionDebugVisualization(Ogre::SceneNode *root_node, Ogre::AxisAlignedBox const &area_limit, std::vector< Ogre::SceneNode * > &out_nodes)
CollisionMeshVec m_collision_meshes
CollisionMeshVec const & getCollisionMeshes() const
static const int MAX_EVENT_SOURCE
static const int LATEST_GROUND_MODEL_VERSION
ground_model_t * defaultgroundgm
static const int ELEMENT_TRI_BASE_INDEX
bool permitEvent(Actor *actor, CollisionEventFilter filter)
Ogre::Quaternion getDirection(const Ogre::String &inst, const Ogre::String &box)
eventsource_t & getEventSource(int pos)
Surface friction properties.
std::map< Ogre::String, ground_model_t > * getGroundModels()
std::vector< collision_box_t * > m_last_called_cboxes
void setupLandUse(const char *configfile)
bool isInside(Ogre::Vector3 pos, const Ogre::String &inst, const Ogre::String &box, float border=0)
void hash_add(int cell_x, int cell_z, int value, float h)
Ogre::AxisAlignedBox m_collision_aab
Ogre::Quaternion es_direction
Ogre::Quaternion orientation
void finishLoadingTerrain()
unsigned int hashfunc(unsigned int cellid)
Returns index to 'hashtable'.
CollisionBoxVec const & getCollisionBoxes() const
hash_coll_element_t(unsigned int cell_id_, int value)
bool IsCollisionTri() const
static const int CELL_SIZE
eventsource_t eventsources[MAX_EVENT_SOURCE]
CollisionBoxVec m_collision_boxes