PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNMPhysicsJointUniversal.h * 00003 * 00004 * Copyright (C) 2002-2012 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_JOINTUNIVERSAL_H__ 00024 #define __PLPHYSICS_SCENENODEMODIFIERS_JOINTUNIVERSAL_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 universal joint scene node modifier 00047 * 00048 * @remarks 00049 * A universal joint is a constraint that restricts two rigid bodies to be connected to a point 00050 * fixed on both bodies, while and allowing one body to spin around a fix axis in is own frame, 00051 * and the other body to spin around another axis fixes on it own frame. Both axis must be 00052 * mutually perpendicular. 00053 */ 00054 class SNMPhysicsJointUniversal : public SNMPhysicsJoint { 00055 00056 00057 //[-------------------------------------------------------] 00058 //[ RTTI interface ] 00059 //[-------------------------------------------------------] 00060 pl_class(PLPHYSICS_RTTI_EXPORT, SNMPhysicsJointUniversal, "PLPhysics", PLPhysics::SNMPhysicsJoint, "Physics universal joint scene node modifier") 00061 // Attributes 00062 pl_attribute(PivotPoint, PLMath::Vector3, PLMath::Vector3::Zero, ReadWrite, GetSet, "Origin of the universal in local space", "") 00063 pl_attribute(PinDir1, PLMath::Vector3, PLMath::Vector3::UnitY, ReadWrite, GetSet, "First axis of rotation fixed on THIS body and perpendicular to 'PinDir2' in scene container space if the 'LocalPinDirection'-flag is not set, else in local scene node space", "") 00064 pl_attribute(PinDir2, PLMath::Vector3, PLMath::Vector3::UnitZ, ReadWrite, GetSet, "Second axis of rotation fixed on 'Target' body and perpendicular to 'PinDir1' in scene container space if the 'LocalPinDirection'-flag is not set, else in local scene node space", "") 00065 // Constructors 00066 pl_constructor_1(ParameterConstructor, PLScene::SceneNode&, "Parameter constructor", "") 00067 pl_class_end 00068 00069 00070 //[-------------------------------------------------------] 00071 //[ Public RTTI get/set functions ] 00072 //[-------------------------------------------------------] 00073 public: 00074 PLPHYSICS_API const PLMath::Vector3 &GetPivotPoint() const; 00075 PLPHYSICS_API void SetPivotPoint(const PLMath::Vector3 &vValue); 00076 PLPHYSICS_API const PLMath::Vector3 &GetPinDir1() const; 00077 PLPHYSICS_API void SetPinDir1(const PLMath::Vector3 &vValue); 00078 PLPHYSICS_API const PLMath::Vector3 &GetPinDir2() const; 00079 PLPHYSICS_API void SetPinDir2(const PLMath::Vector3 &vValue); 00080 00081 00082 //[-------------------------------------------------------] 00083 //[ Public functions ] 00084 //[-------------------------------------------------------] 00085 public: 00086 /** 00087 * @brief 00088 * Constructor 00089 * 00090 * @param[in] cSceneNode 00091 * Owner scene node 00092 */ 00093 PLPHYSICS_API SNMPhysicsJointUniversal(PLScene::SceneNode &cSceneNode); 00094 00095 /** 00096 * @brief 00097 * Destructor 00098 */ 00099 PLPHYSICS_API virtual ~SNMPhysicsJointUniversal(); 00100 00101 00102 //[-------------------------------------------------------] 00103 //[ Private data ] 00104 //[-------------------------------------------------------] 00105 private: 00106 PLMath::Vector3 m_vPivotPoint; /**< Origin of the universal in local space */ 00107 PLMath::Vector3 m_vPinDir1; /**< First axis of rotation fixed on THIS body and perpendicular to 'PinDir2' in local space */ 00108 PLMath::Vector3 m_vPinDir2; /**< Second axis of rotation fixed on 'Target' body and perpendicular to 'PinDir1' in local space */ 00109 00110 00111 //[-------------------------------------------------------] 00112 //[ Private virtual SNMPhysicsJoint functions ] 00113 //[-------------------------------------------------------] 00114 private: 00115 virtual void CreatePhysicsJoint() override; 00116 00117 00118 }; 00119 00120 00121 //[-------------------------------------------------------] 00122 //[ Namespace ] 00123 //[-------------------------------------------------------] 00124 } // PLPhysics 00125 00126 00127 #endif // __PLPHYSICS_SCENENODEMODIFIERS_JOINTUNIVERSAL_H__
|