PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNMPhysicsJointUpVector.h * 00003 * 00004 * Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLPHYSICS_SCENENODEMODIFIERS_JOINTUPVECTOR_H__ 00024 #define __PLPHYSICS_SCENENODEMODIFIERS_JOINTUPVECTOR_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLMath/Vector3.h> 00032 #include "PLPhysics/SceneNodeModifiers/SNMPhysicsJoint.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLPhysics { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * Physics up vector joint scene node modifier 00047 * 00048 * @remarks 00049 * This scene node modifier adds an up vector joint. An up vector joint is a constraint that allows a body 00050 * to translate freely in 3d space, but it only allows the body to rotate around the pin direction 00051 * vector. This could be use by the application to control a character with physics and collision. 00052 * Since the up vector joint is a unuary constraint, there is not need to have user callback or 00053 * user data assigned to it. The application can simple hold to the joint handle and update the pin 00054 * on the force callback function of the rigid body owning the joint. 00055 * 00056 * @note 00057 * - This joint type has no target 00058 */ 00059 class SNMPhysicsJointUpVector : public SNMPhysicsJoint { 00060 00061 00062 //[-------------------------------------------------------] 00063 //[ RTTI interface ] 00064 //[-------------------------------------------------------] 00065 pl_class(PLPHYSICS_RTTI_EXPORT, SNMPhysicsJointUpVector, "PLPhysics", PLPhysics::SNMPhysicsJoint, "Physics up vector joint scene node modifier") 00066 // Attributes 00067 pl_attribute(PinDir, PLMath::Vector3, PLMath::Vector3(0.0f, 1.0f, 0.0f), ReadWrite, GetSet, "The aligning vector in scene container space if the 'LocalPinDirection'-flag is not set, else in local scene node space", "") 00068 // Constructors 00069 pl_constructor_1(ParameterConstructor, PLScene::SceneNode&, "Parameter constructor", "") 00070 pl_class_end 00071 00072 00073 //[-------------------------------------------------------] 00074 //[ Public RTTI get/set functions ] 00075 //[-------------------------------------------------------] 00076 public: 00077 PLPHYSICS_API const PLMath::Vector3 &GetPinDir() const; 00078 PLPHYSICS_API void SetPinDir(const PLMath::Vector3 &vValue); 00079 00080 00081 //[-------------------------------------------------------] 00082 //[ Public functions ] 00083 //[-------------------------------------------------------] 00084 public: 00085 /** 00086 * @brief 00087 * Constructor 00088 * 00089 * @param[in] cSceneNode 00090 * Owner scene node 00091 */ 00092 PLPHYSICS_API SNMPhysicsJointUpVector(PLScene::SceneNode &cSceneNode); 00093 00094 /** 00095 * @brief 00096 * Destructor 00097 */ 00098 PLPHYSICS_API virtual ~SNMPhysicsJointUpVector(); 00099 00100 00101 //[-------------------------------------------------------] 00102 //[ Private data ] 00103 //[-------------------------------------------------------] 00104 private: 00105 PLMath::Vector3 m_vPinDir; /**< The aligning vector in local space */ 00106 00107 00108 //[-------------------------------------------------------] 00109 //[ Private virtual SNMPhysicsJoint functions ] 00110 //[-------------------------------------------------------] 00111 private: 00112 virtual void CreatePhysicsJoint() override; 00113 00114 00115 }; 00116 00117 00118 //[-------------------------------------------------------] 00119 //[ Namespace ] 00120 //[-------------------------------------------------------] 00121 } // PLPhysics 00122 00123 00124 #endif // __PLPHYSICS_SCENENODEMODIFIERS_JOINTUPVECTOR_H__
|