Leviathan  0.8.0.0
Leviathan game engine
Leviathan::PhysMaterialDataPair Struct Reference

#include <PhysicalMaterial.h>

Public Member Functions

DLLEXPORT PhysMaterialDataPair (const std::string &othername)
 
DLLEXPORT PhysMaterialDataPairSetCollidable (bool collidable)
 Sets the material pair to collide or not with each other. More...
 
DLLEXPORT PhysMaterialDataPairSetSoftness (const float &softness)
 Sets the softness of the material pair. More...
 
DLLEXPORT PhysMaterialDataPairSetElasticity (const float &elasticity)
 Sets the elasticity (restitution) of the material pair. More...
 
DLLEXPORT PhysMaterialDataPairSetFriction (const float &staticfriction, const float &dynamicfriction)
 Sets the friction between the materials. More...
 
DLLEXPORT PhysMaterialDataPairSetCallbacks (const PhysicsMaterialAABBCallback aabb, const PhysicsMaterialContactCallback contact)
 Sets the callback functions that are called when the material interacts. More...
 
void ApplySettingsToWorld (NewtonWorld *world, int thisid, int otherid, PhysicalMaterial *materialowner)
 

Public Attributes

std::string OtherName
 
bool Collidable
 
float Elasticity
 
float StaticFriction
 
float DynamicFriction
 
float Softness
 
PhysicsMaterialAABBCallback AABBCallback
 
PhysicsMaterialContactCallback ContactCallback
 

Detailed Description

Definition at line 31 of file PhysicalMaterial.h.

Constructor & Destructor Documentation

◆ PhysMaterialDataPair()

DLLEXPORT Leviathan::PhysMaterialDataPair::PhysMaterialDataPair ( const std::string &  othername)
inline

Definition at line 32 of file PhysicalMaterial.h.

Member Function Documentation

◆ ApplySettingsToWorld()

void Leviathan::PhysMaterialDataPair::ApplySettingsToWorld ( NewtonWorld *  world,
int  thisid,
int  otherid,
PhysicalMaterial materialowner 
)

Definition at line 80 of file PhysicalMaterial.cpp.

82 {
83  // Variables //
84  NewtonMaterialSetDefaultElasticity(world, thisid, otherid, Elasticity);
85  NewtonMaterialSetDefaultCollidable(world, thisid, otherid, Collidable);
86  NewtonMaterialSetDefaultFriction(world, thisid, otherid, StaticFriction, DynamicFriction);
87  NewtonMaterialSetDefaultSoftness(world, thisid, otherid, Softness);
88 
89  // Callback setting //
90  NewtonMaterialSetCollisionCallback(world, thisid, otherid, AABBCallback, ContactCallback);
91 
92  // TODO: check if this is actually used
93  NewtonMaterialSetCallbackUserData(world, thisid, otherid, materialowner);
94 }
PhysicsMaterialContactCallback ContactCallback
PhysicsMaterialAABBCallback AABBCallback

◆ SetCallbacks()

DLLEXPORT PhysMaterialDataPair& Leviathan::PhysMaterialDataPair::SetCallbacks ( const PhysicsMaterialAABBCallback  aabb,
const PhysicsMaterialContactCallback  contact 
)
inline

Sets the callback functions that are called when the material interacts.

Definition at line 78 of file PhysicalMaterial.h.

80  {
81  AABBCallback = aabb;
82  ContactCallback = contact;
83  return *this;
84  }
PhysicsMaterialContactCallback ContactCallback
PhysicsMaterialAABBCallback AABBCallback

◆ SetCollidable()

DLLEXPORT PhysMaterialDataPair& Leviathan::PhysMaterialDataPair::SetCollidable ( bool  collidable)
inline

Sets the material pair to collide or not with each other.

Warning
setting this to false prevents collision callbacks from being called

Definition at line 42 of file PhysicalMaterial.h.

43  {
44  Collidable = collidable;
45  return *this;
46  }

◆ SetElasticity()

DLLEXPORT PhysMaterialDataPair& Leviathan::PhysMaterialDataPair::SetElasticity ( const float &  elasticity)
inline

Sets the elasticity (restitution) of the material pair.

Recommended 1.f and below, default 0.4f, higher value might be more elasticity)

Definition at line 60 of file PhysicalMaterial.h.

61  {
62  Elasticity = elasticity;
63  return *this;
64  }

◆ SetFriction()

DLLEXPORT PhysMaterialDataPair& Leviathan::PhysMaterialDataPair::SetFriction ( const float &  staticfriction,
const float &  dynamicfriction 
)
inline

Sets the friction between the materials.

default static is 0.9f and dynamic (sliding) 0.5f

Definition at line 69 of file PhysicalMaterial.h.

71  {
72  DynamicFriction = dynamicfriction;
73  StaticFriction = staticfriction;
74  return *this;
75  }

◆ SetSoftness()

DLLEXPORT PhysMaterialDataPair& Leviathan::PhysMaterialDataPair::SetSoftness ( const float &  softness)
inline

Sets the softness of the material pair.

Recommended 1.f and below, default 0.15f, higher value is less soft)

Definition at line 51 of file PhysicalMaterial.h.

52  {
53  Softness = softness;
54  return *this;
55  }

Member Data Documentation

◆ AABBCallback

PhysicsMaterialAABBCallback Leviathan::PhysMaterialDataPair::AABBCallback

Definition at line 100 of file PhysicalMaterial.h.

◆ Collidable

bool Leviathan::PhysMaterialDataPair::Collidable

Definition at line 93 of file PhysicalMaterial.h.

◆ ContactCallback

PhysicsMaterialContactCallback Leviathan::PhysMaterialDataPair::ContactCallback

Definition at line 101 of file PhysicalMaterial.h.

◆ DynamicFriction

float Leviathan::PhysMaterialDataPair::DynamicFriction

Definition at line 96 of file PhysicalMaterial.h.

◆ Elasticity

float Leviathan::PhysMaterialDataPair::Elasticity

Definition at line 94 of file PhysicalMaterial.h.

◆ OtherName

std::string Leviathan::PhysMaterialDataPair::OtherName

Definition at line 92 of file PhysicalMaterial.h.

◆ Softness

float Leviathan::PhysMaterialDataPair::Softness

Definition at line 97 of file PhysicalMaterial.h.

◆ StaticFriction

float Leviathan::PhysMaterialDataPair::StaticFriction

Definition at line 95 of file PhysicalMaterial.h.


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