Panda3D
Public Member Functions | Static Public Member Functions
PhysxMaterial Class Reference

A class for describing a shape's surface properties. More...

#include "physxMaterial.h"

Inheritance diagram for PhysxMaterial:
PhysxObject PhysxEnums TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Public Member Functions

virtual TypeHandle force_init_type ()
LVector3f get_dir_of_anisotropy () const
 Returns the direction of anisotropy value.
float get_dynamic_friction () const
 Returns the DynamicFriction value.
float get_dynamic_friction_v () const
 Returns the dynamic friction coefficient for the V direction.
bool get_flag (PhysxMaterialFlag flag) const
 Returns the value of a single flag.
PhysxCombineMode get_friction_combine_mode () const
 Returns the friction combine mode.
unsigned short get_material_index () const
 Returns the material index for this material.
float get_restitution () const
 Returns the coefficient of restitution.
PhysxCombineMode get_restitution_combine_mode () const
 Returns the restitution combine mode.
PhysxSceneget_scene () const
 Returns the scene that owns this material.
float get_static_friction () const
 Returns the coefficient of static friction.
float get_static_friction_v () const
 Returns the static friction coefficient for the V direction.
virtual TypeHandle get_type () const
void link (NxMaterial *ptr)
void load_from_desc (const PhysxMaterialDesc &materialDesc)
 Loads the entire state of the material from a descriptor with a single call.
void ls () const
void ls (ostream &out, int indent_level=0) const
NxMaterial * ptr () const
void release ()
void save_to_desc (PhysxMaterialDesc &materialDesc) const
 Saves the state of the material object to a descriptor.
void set_dir_of_anisotropy (const LVector3f dir)
 Sets the shape space direction (unit vector) of anisotropy.
void set_dynamic_friction (float coef)
 Sets the coefficient of dynamic friction.
void set_dynamic_friction_v (float coef)
 Sets the dynamic friction coefficient along the secondary (V) axis.
void set_flag (PhysxMaterialFlag flag, bool value)
 Sets the value of a single flag.
void set_friction_combine_mode (PhysxCombineMode mode)
 Sets the friction combine mode.
void set_restitution (float rest)
 Sets the coefficient of restitution.
void set_restitution_combine_mode (PhysxCombineMode mode)
 Sets the restitution combine mode.
void set_static_friction (float coef)
 Sets the coefficient of static friction.
void set_static_friction_v (float coef)
 Sets the static friction coefficient along the secondary (V) axis.
void unlink ()

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.

Detailed Description

A class for describing a shape's surface properties.

You can create a material which has different friction coefficients depending on the direction that a body in contact is trying to move in. This is called anisotropic friction.

Anisotropic friction is useful for modeling things like sledges, skis etc

When you create an anisotropic material you specify the default friction parameters and also friction parameters for the V axis. The friction parameters for the V axis are applied to motion along the direction of anisotropy (dirOfAnisotropy).

Default material: You can change the properties of the default material by querying for material index 0.

Definition at line 51 of file physxMaterial.h.


Member Function Documentation

Returns the direction of anisotropy value.

Definition at line 323 of file physxMaterial.cxx.

References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().

Returns the DynamicFriction value.

Definition at line 208 of file physxMaterial.cxx.

Returns the dynamic friction coefficient for the V direction.

Definition at line 264 of file physxMaterial.cxx.

bool PhysxMaterial::get_flag ( PhysxMaterialFlag  flag) const

Returns the value of a single flag.

Definition at line 297 of file physxMaterial.cxx.

PhysxEnums::PhysxCombineMode PhysxMaterial::get_friction_combine_mode ( ) const

Returns the friction combine mode.

Definition at line 351 of file physxMaterial.cxx.

unsigned short PhysxMaterial::get_material_index ( ) const

Returns the material index for this material.

Materials are associated with mesh faces and shapes using material index identifiers.

If you release a material while its material index is still in use by shapes or meshes, the material usage of these objects becomes undefined as the material index gets recycled.

Definition at line 95 of file physxMaterial.cxx.

Returns the coefficient of restitution.

Definition at line 148 of file physxMaterial.cxx.

PhysxEnums::PhysxCombineMode PhysxMaterial::get_restitution_combine_mode ( ) const

Returns the restitution combine mode.

Definition at line 379 of file physxMaterial.cxx.

Returns the scene that owns this material.

Definition at line 75 of file physxMaterial.cxx.

Returns the coefficient of static friction.

Definition at line 177 of file physxMaterial.cxx.

Returns the static friction coefficient for the V direction.

Definition at line 236 of file physxMaterial.cxx.

static void PhysxMaterial::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from PhysxObject.

Definition at line 104 of file physxMaterial.h.

References PhysxObject::init_type().

void PhysxMaterial::load_from_desc ( const PhysxMaterialDesc materialDesc)

Loads the entire state of the material from a descriptor with a single call.

Definition at line 108 of file physxMaterial.cxx.

void PhysxMaterial::save_to_desc ( PhysxMaterialDesc materialDesc) const

Saves the state of the material object to a descriptor.

Definition at line 121 of file physxMaterial.cxx.

Sets the shape space direction (unit vector) of anisotropy.

This is only used if the flag MF_anisotropic is set.

Definition at line 311 of file physxMaterial.cxx.

References PhysxManager::vec3_to_nxVec3().

Sets the coefficient of dynamic friction.

The coefficient of dynamic friction should be in [0, +inf]. If set to greater than staticFriction, the effective value of staticFriction will be increased to match. If the flag MF_anisotropic is set, then this value is used for the primary direction of anisotropy (U axis).

Definition at line 196 of file physxMaterial.cxx.

Sets the dynamic friction coefficient along the secondary (V) axis.

This is used when anisotropic friction is being applied. I.e. the flag MF_anisotropic is set.

Definition at line 251 of file physxMaterial.cxx.

void PhysxMaterial::set_flag ( PhysxMaterialFlag  flag,
bool  value 
)

Sets the value of a single flag.

Definition at line 276 of file physxMaterial.cxx.

void PhysxMaterial::set_friction_combine_mode ( PhysxCombineMode  mode)

Sets the friction combine mode.

  • CM_average : Average: (a + b)/2.
  • CM_min : Minimum: min(a,b).
  • CM_multiply : Multiply: a*b.
  • CM_max : Maximum: max(a,b).

Definition at line 339 of file physxMaterial.cxx.

void PhysxMaterial::set_restitution ( float  restitution)

Sets the coefficient of restitution.

A coefficient of 0 makes the object bounce as little as possible, higher values up to 1.0 result in more bounce.

Definition at line 136 of file physxMaterial.cxx.

void PhysxMaterial::set_restitution_combine_mode ( PhysxCombineMode  mode)

Sets the restitution combine mode.

  • CM_average : Average: (a + b)/2.
  • CM_min : Minimum: min(a,b).
  • CM_multiply : Multiply: a*b.
  • CM_max : Maximum: max(a,b).

Definition at line 367 of file physxMaterial.cxx.

void PhysxMaterial::set_static_friction ( float  coef)

Sets the coefficient of static friction.

The coefficient of static friction should be in the range [0, +inf]. If the flag MF_anisotropic is set, then this value is used for the primary direction of anisotropy (U axis).

Definition at line 165 of file physxMaterial.cxx.

Sets the static friction coefficient along the secondary (V) axis.

This is used when anisotropic friction is being applied. I.e. the flag MF_anisotropic is set.

Definition at line 223 of file physxMaterial.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations