00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "physxCapsuleShape.h"
00016 #include "physxCapsuleShapeDesc.h"
00017
00018 TypeHandle PhysxCapsuleShape::_type_handle;
00019
00020
00021
00022
00023
00024
00025 void PhysxCapsuleShape::
00026 link(NxShape *shapePtr) {
00027
00028 _ptr = shapePtr->isCapsule();
00029 _ptr->userData = this;
00030 _error_type = ET_ok;
00031
00032 set_name(shapePtr->getName());
00033
00034 PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
00035 actor->_shapes.add(this);
00036 }
00037
00038
00039
00040
00041
00042
00043 void PhysxCapsuleShape::
00044 unlink() {
00045
00046 _ptr->userData = NULL;
00047 _error_type = ET_released;
00048
00049 PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
00050 actor->_shapes.remove(this);
00051 }
00052
00053
00054
00055
00056
00057
00058
00059 void PhysxCapsuleShape::
00060 save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const {
00061
00062 nassertv(_error_type == ET_ok);
00063 _ptr->saveToDesc(shapeDesc._desc);
00064 }
00065
00066
00067
00068
00069
00070
00071 void PhysxCapsuleShape::
00072 set_radius(float radius) {
00073
00074 nassertv(_error_type == ET_ok);
00075 _ptr->setRadius(radius);
00076 }
00077
00078
00079
00080
00081
00082
00083 void PhysxCapsuleShape::
00084 set_height(float height) {
00085
00086 nassertv(_error_type == ET_ok);
00087 _ptr->setHeight(height);
00088 }
00089
00090
00091
00092
00093
00094
00095 float PhysxCapsuleShape::
00096 get_radius() const {
00097
00098 nassertr(_error_type == ET_ok, 0.0f);
00099 return _ptr->getRadius();
00100 }
00101
00102
00103
00104
00105
00106
00107 float PhysxCapsuleShape::
00108 get_height() const {
00109
00110 nassertr(_error_type == ET_ok, 0.0f);
00111 return _ptr->getHeight();
00112 }
00113