Panda3D
|
Public Member Functions | |
void | add_directed_force_at_pos (LPoint3f const &pos, LVector3f const &force, float radius, PhysxForceMode mode=FM_force) |
Applies a directed force (or impulse) at a particular position. | |
void | add_force_at_pos (LPoint3f const &pos, float magnitude, float radius, PhysxForceMode mode=FM_force) |
Applies a radial force (or impulse) at a particular position. | |
void | add_force_at_vertex (LVector3f const &force, int vertexId, PhysxForceMode mode=FM_force) |
Applies a force (or impulse) defined in the global coordinate frame, to a particular vertex of the cloth. | |
void | attach_to_colliding_shapes () |
Attaches the cloth to all shapes, currently colliding. | |
void | attach_to_shape (PhysxShape *shape) |
Attaches the cloth to a shape. | |
void | attach_vertex_to_global_pos (unsigned int vertexId, LPoint3f const &pos) |
Attaches a cloth vertex to a position in world space. | |
void | attach_vertex_to_shape (unsigned int vertexId, PhysxShape *shape, LPoint3f const &localPos) |
Attaches a cloth vertex to a local position within a shape. | |
PhysxClothNode * | create_cloth_node (const char *name) |
void | detach_from_shape (PhysxShape *shape) |
Detaches the cloth from a shape it has been attached to before. | |
virtual TypeHandle | force_init_type () |
void | free_vertex (unsigned int vertexId) |
Frees a previously attached cloth point. | |
PhysxClothNode * | get_cloth_node () const |
float | get_density () const |
Gets the cloth density. | |
LVector3f | get_external_acceleration () const |
Retrieves the external acceleration which affects all non attached particles of the cloth. | |
bool | get_flag (PhysxClothFlag flag) const |
Retrieves the value of a single flag. | |
unsigned int | get_group () const |
Retrieves the collision group this cloth is part of. | |
PhysxGroupsMask | get_groups_mask () const |
Gets the 128-bit groups mask used for collision filtering. | |
const char * | get_name () const |
Retrieves the name string. | |
unsigned int | get_num_particles () |
Gets the number of cloth particles. | |
float | get_relative_grid_spacing () const |
Gets the relative grid spacing for the broad phase. | |
PhysxScene * | get_scene () const |
Returns the scene which this cloth belongs to. | |
float | get_sleep_linear_velocity () const |
Returns the linear velocity below which an soft body may go to sleep. | |
float | get_thickness () const |
Gets the cloth thickness. | |
virtual TypeHandle | get_type () const |
LPoint3f | get_vertex_attachment_pos (unsigned int vertexId) const |
Returns the attachment position of the given vertex. | |
PhysxShape * | get_vertex_attachment_shape (unsigned int vertexId) const |
Returns the pointer to an attached shape pointer of the given vertex. | |
PhysxVertexAttachmentStatus | get_vertex_attachment_status (unsigned int vertexId) const |
Return the attachment status of the given vertex. | |
LVector3f | get_wind_acceleration () const |
Retrieves the acceleration acting normal to the cloth surface at each vertex. | |
bool | is_sleeping () const |
Returns true if this cloth is sleeping. | |
void | link (NxCloth *ptr) |
void | ls () const |
void | ls (ostream &out, int indent_level=0) const |
NxCloth * | ptr () const |
void | put_to_sleep () |
Forces the cloth to sleep. | |
void | release () |
void | set_external_acceleration (LVector3f const &acceleration) |
Sets an external acceleration which affects all non attached particles of the cloth. | |
void | set_flag (PhysxClothFlag flag, bool value) |
Sets the value of a single flag. | |
void | set_group (unsigned int group) |
Sets which collision group this cloth is part of. | |
void | set_groups_mask (const PhysxGroupsMask &mask) |
Sets 128-bit mask used for collision filtering. | |
void | set_name (const char *name) |
Sets a name string for the object that can be retrieved with get_name(). | |
void | set_sleep_linear_velocity (float threshold) |
Sets the linear velocity below which an cloth may go to sleep. | |
void | set_thickness (float thickness) |
Sets the cloth thickness (must be positive). | |
void | set_wind_acceleration (LVector3f const &acceleration) |
Sets an acceleration acting normal to the cloth surface at each vertex. | |
void | unlink () |
void | update () |
void | wake_up (float wakeCounterValue=NX_SLEEP_INTERVAL) |
Wakes up the cloth if it is sleeping. | |
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. |
Definition at line 34 of file physxCloth.h.
void PhysxCloth::add_directed_force_at_pos | ( | LPoint3f const & | pos, |
LVector3f const & | force, | ||
float | radius, | ||
PhysxForceMode | mode = FM_force |
||
) |
Applies a directed force (or impulse) at a particular position.
All vertices within radius will be affected with a quadratic drop-off.
Definition at line 668 of file physxCloth.cxx.
References PhysxManager::point3_to_nxVec3(), and PhysxManager::vec3_to_nxVec3().
void PhysxCloth::add_force_at_pos | ( | LPoint3f const & | pos, |
float | magnitude, | ||
float | radius, | ||
PhysxForceMode | mode = FM_force |
||
) |
Applies a radial force (or impulse) at a particular position.
All vertices within radius will be affected with a quadratic drop-off.
Definition at line 651 of file physxCloth.cxx.
References PhysxManager::point3_to_nxVec3().
void PhysxCloth::add_force_at_vertex | ( | LVector3f const & | force, |
int | vertexId, | ||
PhysxForceMode | mode = FM_force |
||
) |
Applies a force (or impulse) defined in the global coordinate frame, to a particular vertex of the cloth.
Definition at line 635 of file physxCloth.cxx.
References PhysxManager::vec3_to_nxVec3().
Attaches the cloth to all shapes, currently colliding.
This method only works with primitive and convex shapes. Since the inside of a general triangle mesh is not clearly defined.
Definition at line 463 of file physxCloth.cxx.
void PhysxCloth::attach_to_shape | ( | PhysxShape * | shape | ) |
Attaches the cloth to a shape.
All cloth points currently inside the shape are attached.
This method only works with primitive and convex shapes. Since the inside of a general triangle mesh is not clearly defined.
Definition at line 443 of file physxCloth.cxx.
void PhysxCloth::attach_vertex_to_global_pos | ( | unsigned int | vertexId, |
LPoint3f const & | pos | ||
) |
Attaches a cloth vertex to a position in world space.
Definition at line 424 of file physxCloth.cxx.
References LVecBase3f::is_nan(), and PhysxManager::point3_to_nxVec3().
void PhysxCloth::attach_vertex_to_shape | ( | unsigned int | vertexId, |
PhysxShape * | shape, | ||
LPoint3f const & | localPos | ||
) |
Attaches a cloth vertex to a local position within a shape.
Definition at line 508 of file physxCloth.cxx.
References LVecBase3f::is_nan(), and PhysxManager::point3_to_nxVec3().
void PhysxCloth::detach_from_shape | ( | PhysxShape * | shape | ) |
Detaches the cloth from a shape it has been attached to before.
If the cloth has not been attached to the shape before, the call has no effect.
Definition at line 481 of file physxCloth.cxx.
void PhysxCloth::free_vertex | ( | unsigned int | vertexId | ) |
Frees a previously attached cloth point.
Definition at line 495 of file physxCloth.cxx.
float PhysxCloth::get_density | ( | ) | const |
Gets the cloth density.
Definition at line 227 of file physxCloth.cxx.
Retrieves the external acceleration which affects all non attached particles of the cloth.
Definition at line 608 of file physxCloth.cxx.
References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().
bool PhysxCloth::get_flag | ( | PhysxClothFlag | flag | ) | const |
Retrieves the value of a single flag.
Definition at line 290 of file physxCloth.cxx.
unsigned int PhysxCloth::get_group | ( | ) | const |
Retrieves the collision group this cloth is part of.
Definition at line 191 of file physxCloth.cxx.
PhysxGroupsMask PhysxCloth::get_groups_mask | ( | ) | const |
Gets the 128-bit groups mask used for collision filtering.
Definition at line 318 of file physxCloth.cxx.
const char * PhysxCloth::get_name | ( | ) | const |
Retrieves the name string.
Definition at line 164 of file physxCloth.cxx.
unsigned int PhysxCloth::get_num_particles | ( | ) |
Gets the number of cloth particles.
Definition at line 256 of file physxCloth.cxx.
float PhysxCloth::get_relative_grid_spacing | ( | ) | const |
Gets the relative grid spacing for the broad phase.
The cloth is represented by a set of world aligned cubical cells in broad phase. The size of these cells is determined by multiplying the length of the diagonal of the AABB of the initial soft body size with this constant.
Definition at line 244 of file physxCloth.cxx.
PhysxScene * PhysxCloth::get_scene | ( | ) | const |
Returns the scene which this cloth belongs to.
Definition at line 107 of file physxCloth.cxx.
float PhysxCloth::get_sleep_linear_velocity | ( | ) | const |
Returns the linear velocity below which an soft body may go to sleep.
cloths whose linear velocity is above this threshold will not be put to sleep.
Definition at line 411 of file physxCloth.cxx.
float PhysxCloth::get_thickness | ( | ) | const |
Gets the cloth thickness.
Definition at line 215 of file physxCloth.cxx.
LPoint3f PhysxCloth::get_vertex_attachment_pos | ( | unsigned int | vertexId | ) | const |
Returns the attachment position of the given vertex.
If the vertex is attached to shape, the position local to the shape's pose is returned. If the vertex is not attached, the return value is undefined.
Definition at line 563 of file physxCloth.cxx.
References PhysxManager::nxVec3_to_point3(), and LPoint3f::zero().
PhysxShape * PhysxCloth::get_vertex_attachment_shape | ( | unsigned int | vertexId | ) | const |
Returns the pointer to an attached shape pointer of the given vertex.
If the vertex is not attached or attached to a global position, NULL is returned.
Definition at line 542 of file physxCloth.cxx.
PhysxEnums::PhysxVertexAttachmentStatus PhysxCloth::get_vertex_attachment_status | ( | unsigned int | vertexId | ) | const |
Return the attachment status of the given vertex.
Definition at line 526 of file physxCloth.cxx.
LVector3f PhysxCloth::get_wind_acceleration | ( | ) | const |
Retrieves the acceleration acting normal to the cloth surface at each vertex.
Definition at line 621 of file physxCloth.cxx.
References PhysxManager::nxVec3_to_vec3(), and LVector3f::zero().
static void PhysxCloth::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 117 of file physxCloth.h.
References PhysxObject::init_type().
bool PhysxCloth::is_sleeping | ( | ) | const |
Returns true if this cloth is sleeping.
When a cloth does not move for a period of time, it is no longer simulated in order to save time. This state is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, or one of its properties is changed by the user, the entire sleep mechanism should be transparent to the user.
Definition at line 344 of file physxCloth.cxx.
void PhysxCloth::put_to_sleep | ( | ) |
Forces the cloth to sleep.
The cloth will stay asleep until the next call to simulate, and will not wake up until then even when otherwise it would (for example a force is applied to it). It can however wake up during the next do_physics call.
Definition at line 379 of file physxCloth.cxx.
void PhysxCloth::set_external_acceleration | ( | LVector3f const & | acceleration | ) |
Sets an external acceleration which affects all non attached particles of the cloth.
Definition at line 578 of file physxCloth.cxx.
References LVecBase3f::is_nan(), and PhysxManager::vec3_to_nxVec3().
void PhysxCloth::set_flag | ( | PhysxClothFlag | flag, |
bool | value | ||
) |
Sets the value of a single flag.
Definition at line 268 of file physxCloth.cxx.
void PhysxCloth::set_group | ( | unsigned int | group | ) |
Sets which collision group this cloth is part of.
Collision group must be between 0 and 31.
Definition at line 177 of file physxCloth.cxx.
void PhysxCloth::set_groups_mask | ( | const PhysxGroupsMask & | mask | ) |
Sets 128-bit mask used for collision filtering.
Definition at line 303 of file physxCloth.cxx.
void PhysxCloth::set_name | ( | const char * | name | ) |
Sets a name string for the object that can be retrieved with get_name().
This is for debugging and is not used by the engine.
Definition at line 150 of file physxCloth.cxx.
void PhysxCloth::set_sleep_linear_velocity | ( | float | threshold | ) |
Sets the linear velocity below which an cloth may go to sleep.
Cloths whose linear velocity is above this threshold will not be put to sleep.
Setting the sleep angular/linear velocity only makes sense when the BF_energy_sleep_test is not set.
Definition at line 397 of file physxCloth.cxx.
void PhysxCloth::set_thickness | ( | float | thickness | ) |
Sets the cloth thickness (must be positive).
Definition at line 203 of file physxCloth.cxx.
void PhysxCloth::set_wind_acceleration | ( | LVector3f const & | acceleration | ) |
Sets an acceleration acting normal to the cloth surface at each vertex.
Definition at line 593 of file physxCloth.cxx.
References LVecBase3f::is_nan(), and PhysxManager::vec3_to_nxVec3().
void PhysxCloth::wake_up | ( | float | wakeCounterValue = NX_SLEEP_INTERVAL | ) |
Wakes up the cloth if it is sleeping.
The wakeCounterValue determines how long until the body is put to sleep, a value of zero means that the body is sleeping. wake_up(0) is equivalent to PhysxCloth::put_to_sleep().
Definition at line 361 of file physxCloth.cxx.