Various nail constraint improvements
TODO: errors while scene loading / saving
This commit is contained in:
@@ -51,7 +51,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/GR /GS /EHsc"
|
AdditionalOptions="/GR /GS /EHsc"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=".;"C:\Program Files\Autodesk\Maya2009\include";"C:\Program Files\Autodesk\Maya2008\include";"C:\Program Files\Alias\Maya8.0\include";../../src;../../Extras\GIMPACT\include"
|
AdditionalIncludeDirectories=".;"C:\Program Files\Autodesk\Maya8.5\include";../../src;../../Extras\GIMPACT\include"
|
||||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;NT_PLUGIN;REQUIRE_IOSTREAM"
|
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;NT_PLUGIN;REQUIRE_IOSTREAM"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
AssemblerListingLocation=".\Debug/"
|
AssemblerListingLocation=".\Debug/"
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
OutputFile="./BulletMayaPluginDebug.mll"
|
OutputFile="./BulletMayaPluginDebug.mll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
AdditionalLibraryDirectories="..\..\lib;"C:\Program Files\Autodesk\Maya2009\lib";"C:\Program Files\Autodesk\Maya2008\lib";C:\develop\disney_bulletmaya\boost_1_35_0\lib;"C:\Program Files\Alias\Maya8.0\lib""
|
AdditionalLibraryDirectories="..\..\lib;"C:\Program Files\Autodesk\Maya8.5\lib";C:\develop\disney_bulletmaya\boost_1_35_0\lib"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
ProgramDatabaseFile=".\Debug/BulletMayaPlugin.pdb"
|
ProgramDatabaseFile=".\Debug/BulletMayaPlugin.pdb"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
@@ -113,6 +113,65 @@
|
|||||||
CommandLine="install.bat"
|
CommandLine="install.bat"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="DebugDll|x64"
|
||||||
|
ConfigurationType="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="ReleaseDll|Win32"
|
Name="ReleaseDll|Win32"
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
@@ -209,6 +268,65 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="ReleaseDll|x64"
|
||||||
|
ConfigurationType="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="ReleaseDebug|Win32"
|
Name="ReleaseDebug|Win32"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
@@ -269,244 +387,6 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="DebugDll|x64"
|
|
||||||
ConfigurationType="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="ReleaseDll|x64"
|
|
||||||
ConfigurationType="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="ReleaseDebug|x64"
|
Name="ReleaseDebug|x64"
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
@@ -567,6 +447,66 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|x64"
|
Name="Debug|x64"
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
@@ -627,6 +567,66 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|x64"
|
Name="Release|x64"
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ protected:
|
|||||||
btVector3 const& scale = m_gi_shape->getLocalScaling();
|
btVector3 const& scale = m_gi_shape->getLocalScaling();
|
||||||
|
|
||||||
std::vector<vec3f> vertices(m_vertices.size());
|
std::vector<vec3f> vertices(m_vertices.size());
|
||||||
for(int i = 0; i < vertices.size(); ++i) {
|
for(unsigned int i = 0; i < vertices.size(); ++i) {
|
||||||
vertices[i] = vec3f(scale.x() * m_vertices[i][0], scale.y() * m_vertices[i][1], scale.z() * m_vertices[i][2]);
|
vertices[i] = vec3f(scale.x() * m_vertices[i][0], scale.y() * m_vertices[i][1], scale.z() * m_vertices[i][2]);
|
||||||
}
|
}
|
||||||
m_volume = ::volume(&(vertices[0]), (int*)&(m_indices[0]), (int)m_indices.size());
|
m_volume = ::volume(&(vertices[0]), (int*)&(m_indices[0]), (int)m_indices.size());
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_plane_shape.h
|
//bt_plane_shape.h
|
||||||
@@ -36,7 +40,7 @@ public:
|
|||||||
// std::cout << "bt_plane_shape_t::draw" << std::endl;
|
// std::cout << "bt_plane_shape_t::draw" << std::endl;
|
||||||
// btStaticPlaneShape *plane_shape = static_cast<btStaticPlaneShape*>(shape());
|
// btStaticPlaneShape *plane_shape = static_cast<btStaticPlaneShape*>(shape());
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glScalef(100.0, 0.001, 100.0);
|
glScalef(100.0f, 0.001f, 100.0f);
|
||||||
if(draw_style & collision_shape_t::kDSSolid) {
|
if(draw_style & collision_shape_t::kDSSolid) {
|
||||||
solid_cube();
|
solid_cube();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_rigid_body.h
|
//bt_rigid_body.h
|
||||||
@@ -160,7 +164,7 @@ public:
|
|||||||
int count = m_constraintRef.size();
|
int count = m_constraintRef.size();
|
||||||
for(int i=0; i<count; i++)
|
for(int i=0; i<count; i++)
|
||||||
{
|
{
|
||||||
m_constraintRef[i]->update_constraint();
|
m_constraintRef[i]->update_constraint(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,14 +185,14 @@ protected:
|
|||||||
bt_rigid_body_t(collision_shape_impl_t* cs):
|
bt_rigid_body_t(collision_shape_impl_t* cs):
|
||||||
m_collision_shape(cs),
|
m_collision_shape(cs),
|
||||||
m_mass(1),
|
m_mass(1),
|
||||||
m_inertia(2.0/5.0, 2.0/5.0, 2.0/5.0),
|
m_inertia(2.0f/5.0f, 2.0f/5.0f, 2.0f/5.0f),
|
||||||
m_linear_damping(0),
|
m_linear_damping(0),
|
||||||
m_angular_damping(0)
|
m_angular_damping(0)
|
||||||
{
|
{
|
||||||
bt_collision_shape_t* bt_shape = dynamic_cast<bt_collision_shape_t*>(cs);
|
bt_collision_shape_t* bt_shape = dynamic_cast<bt_collision_shape_t*>(cs);
|
||||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(m_mass, NULL, bt_shape->shape(), m_inertia);
|
btRigidBody::btRigidBodyConstructionInfo rbInfo(m_mass, NULL, bt_shape->shape(), m_inertia);
|
||||||
rbInfo.m_restitution = 0;
|
rbInfo.m_restitution = 0;
|
||||||
rbInfo.m_friction = 0.1;
|
rbInfo.m_friction = 0.1f;
|
||||||
rbInfo.m_linearDamping = m_linear_damping;
|
rbInfo.m_linearDamping = m_linear_damping;
|
||||||
rbInfo.m_angularDamping = m_angular_damping;
|
rbInfo.m_angularDamping = m_angular_damping;
|
||||||
m_body.reset(new btRigidBody(rbInfo));
|
m_body.reset(new btRigidBody(rbInfo));
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_solver.h
|
//bt_solver.h
|
||||||
@@ -79,6 +83,10 @@ public:
|
|||||||
{
|
{
|
||||||
return new bt_nail_constraint_t(rb, pivot);
|
return new bt_nail_constraint_t(rb, pivot);
|
||||||
}
|
}
|
||||||
|
virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_t* rbA, rigid_body_impl_t* rbB, vec3f const& pivot)
|
||||||
|
{
|
||||||
|
return new bt_nail_constraint_t(rbA, rbB, pivot);
|
||||||
|
}
|
||||||
virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_impl_t* rb, vec3f const& pivot)
|
virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_impl_t* rb, vec3f const& pivot)
|
||||||
{
|
{
|
||||||
return new bt_hinge_constraint_t(rb, pivot);
|
return new bt_hinge_constraint_t(rb, pivot);
|
||||||
@@ -95,6 +103,7 @@ public:
|
|||||||
virtual void add_rigid_body(rigid_body_impl_t* rb)
|
virtual void add_rigid_body(rigid_body_impl_t* rb)
|
||||||
{
|
{
|
||||||
bt_rigid_body_t* bt_body = static_cast<bt_rigid_body_t*>(rb);
|
bt_rigid_body_t* bt_body = static_cast<bt_rigid_body_t*>(rb);
|
||||||
|
bt_body->body()->setActivationState(DISABLE_DEACTIVATION);
|
||||||
m_dynamicsWorld->addRigidBody(bt_body->body());
|
m_dynamicsWorld->addRigidBody(bt_body->body());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +137,7 @@ public:
|
|||||||
|
|
||||||
virtual void step_simulation(float dt)
|
virtual void step_simulation(float dt)
|
||||||
{
|
{
|
||||||
m_dynamicsWorld->stepSimulation(dt, 1000, 1.0 / 120.0);
|
m_dynamicsWorld->stepSimulation(dt, 1000, 1.0f / 120.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void export_collada_file(const char* fileName);
|
virtual void export_collada_file(const char* fileName);
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_sphere_shape.h
|
//bt_sphere_shape.h
|
||||||
@@ -88,12 +92,12 @@ protected:
|
|||||||
{
|
{
|
||||||
btSphereShape *sphere_shape = static_cast<btSphereShape*>(shape());
|
btSphereShape *sphere_shape = static_cast<btSphereShape*>(shape());
|
||||||
float radius = sphere_shape->getRadius();
|
float radius = sphere_shape->getRadius();
|
||||||
m_volume = (4.0 * 3.1415926 * radius * radius * radius) / 3.0;
|
m_volume = (4.0f * 3.1415926f * radius * radius * radius) / 3.0f;
|
||||||
m_center = vec3f(0, 0, 0);
|
m_center = vec3f(0, 0, 0);
|
||||||
m_rotation = qidentity<float>();
|
m_rotation = qidentity<float>();
|
||||||
m_local_inertia = vec3f(2.0 / 5.0 * radius * radius,
|
m_local_inertia = vec3f(2.0f / 5.0f * radius * radius,
|
||||||
2.0 / 5.0 * radius * radius,
|
2.0f / 5.0f * radius * radius,
|
||||||
2.0 / 5.0 * radius * radius);
|
2.0f / 5.0f * radius * radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_constraint.h
|
//bt_constraint.h
|
||||||
@@ -29,6 +33,8 @@ Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
|||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "shared_ptr.h"
|
#include "shared_ptr.h"
|
||||||
|
|
||||||
|
class rigid_body_impl_t;
|
||||||
|
|
||||||
class bt_constraint_t
|
class bt_constraint_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -40,7 +46,7 @@ protected:
|
|||||||
|
|
||||||
btTypedConstraint* constraint() { return m_constraint.get(); }
|
btTypedConstraint* constraint() { return m_constraint.get(); }
|
||||||
void set_constraint(btTypedConstraint *constraint) { return m_constraint.reset(constraint); }
|
void set_constraint(btTypedConstraint *constraint) { return m_constraint.reset(constraint); }
|
||||||
virtual void update_constraint() = 0;
|
virtual void update_constraint(rigid_body_impl_t* rb) = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
friend class bt_rigid_body_t;
|
friend class bt_rigid_body_t;
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_hinge_constraint.h
|
//bt_hinge_constraint.h
|
||||||
@@ -97,7 +101,7 @@ public:
|
|||||||
hinge->enableAngularMotor(enable, velocity, impulse);
|
hinge->enableAngularMotor(enable, velocity, impulse);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void update_constraint()
|
virtual void update_constraint(rigid_body_impl_t* rb)
|
||||||
{
|
{
|
||||||
btHingeConstraint* hc = static_cast<btHingeConstraint*>(m_constraint.get());
|
btHingeConstraint* hc = static_cast<btHingeConstraint*>(m_constraint.get());
|
||||||
btVector3 world = hc->getBFrame().getOrigin();
|
btVector3 world = hc->getBFrame().getOrigin();
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_nail_constraint.h
|
//bt_nail_constraint.h
|
||||||
@@ -58,10 +62,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void get_world_pivot(vec3f &p) const {
|
virtual void get_world_pivot(vec3f &p) const {
|
||||||
|
// btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointConstraint const*>(m_constraint.get());
|
||||||
|
// p[0] = p2pc->getPivotInB().x();
|
||||||
|
// p[1] = p2pc->getPivotInB().y();
|
||||||
|
// p[2] = p2pc->getPivotInB().z();
|
||||||
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointConstraint const*>(m_constraint.get());
|
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointConstraint const*>(m_constraint.get());
|
||||||
p[0] = p2pc->getPivotInB().x();
|
btVector3 pivotAinW = p2pc->getRigidBodyA().getCenterOfMassTransform()* p2pc->getPivotInA();
|
||||||
p[1] = p2pc->getPivotInB().y();
|
p[0] = pivotAinW.x();
|
||||||
p[2] = p2pc->getPivotInB().z();
|
p[1] = pivotAinW.y();
|
||||||
|
p[2] = pivotAinW.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void set_world(vec3f const &p) {
|
virtual void set_world(vec3f const &p) {
|
||||||
@@ -69,23 +78,47 @@ public:
|
|||||||
btVector3 world(p[0], p[1], p[2]);
|
btVector3 world(p[0], p[1], p[2]);
|
||||||
btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform().inverse() (world);
|
btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform().inverse() (world);
|
||||||
p2pc->setPivotA(pivotA);
|
p2pc->setPivotA(pivotA);
|
||||||
p2pc->setPivotB(world);
|
btVector3 pivotB = p2pc->getRigidBodyB().getWorldTransform().inverse() (world);
|
||||||
p2pc->buildJacobian();
|
p2pc->setPivotB(pivotB);
|
||||||
|
// p2pc->buildJacobian();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void get_world(vec3f &p) const {
|
virtual void get_world(vec3f &p) const {
|
||||||
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointConstraint const*>(m_constraint.get());
|
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointConstraint const*>(m_constraint.get());
|
||||||
p[0] = p2pc->getPivotInB().x();
|
btVector3 pivotAinW = p2pc->getRigidBodyA().getCenterOfMassTransform()* p2pc->getPivotInA();
|
||||||
p[1] = p2pc->getPivotInB().y();
|
// p[0] = p2pc->getPivotInB().x();
|
||||||
p[2] = p2pc->getPivotInB().z();
|
// p[1] = p2pc->getPivotInB().y();
|
||||||
|
// p[2] = p2pc->getPivotInB().z();
|
||||||
|
p[0] = pivotAinW.x();
|
||||||
|
p[1] = pivotAinW.y();
|
||||||
|
p[2] = pivotAinW.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void update_constraint()
|
virtual void update_constraint(rigid_body_impl_t* rb)
|
||||||
{
|
{
|
||||||
|
btRigidBody* bt_body = static_cast<bt_rigid_body_t*>(rb)->body();
|
||||||
btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint*>(m_constraint.get());
|
btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint*>(m_constraint.get());
|
||||||
btVector3 world = p2pc->getPivotInB();
|
btVector3 world, pivot;
|
||||||
btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform().inverse() (world);
|
if(bt_body == &p2pc->getRigidBodyA())
|
||||||
p2pc->setPivotA(pivotA);
|
{
|
||||||
|
world = p2pc->getRigidBodyB().getWorldTransform() * p2pc->getPivotInB();
|
||||||
|
pivot = p2pc->getRigidBodyA().getWorldTransform().inverse() * world;
|
||||||
|
p2pc->setPivotA(pivot);
|
||||||
|
}
|
||||||
|
else if(bt_body == &p2pc->getRigidBodyB())
|
||||||
|
{
|
||||||
|
world = p2pc->getRigidBodyA().getWorldTransform() * p2pc->getPivotInA();
|
||||||
|
pivot = p2pc->getRigidBodyB().getWorldTransform().inverse() * world;
|
||||||
|
p2pc->setPivotB(pivot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
world.setValue(0.f, 0.f, 0.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// btVector3 world = p2pc->getPivotInB();
|
||||||
|
// btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform().inverse() (world);
|
||||||
|
// p2pc->setPivotA(pivotA);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
friend class bt_solver_t;
|
friend class bt_solver_t;
|
||||||
@@ -93,12 +126,34 @@ protected:
|
|||||||
bt_nail_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot):
|
bt_nail_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot):
|
||||||
nail_constraint_impl_t()
|
nail_constraint_impl_t()
|
||||||
{
|
{
|
||||||
|
btVector3 pivotW(pivot[0], pivot[1], pivot[2]);
|
||||||
btRigidBody& bt_body = *static_cast<bt_rigid_body_t*>(rb)->body();
|
btRigidBody& bt_body = *static_cast<bt_rigid_body_t*>(rb)->body();
|
||||||
btVector3 pivotA = bt_body.getCenterOfMassPosition();
|
const btTransform& tr = bt_body.getCenterOfMassTransform();
|
||||||
m_constraint.reset(new btPoint2PointConstraint(bt_body, -pivotA));
|
btTransform iTr = tr.inverse();
|
||||||
|
btVector3 nPivot = iTr * pivotW;
|
||||||
|
m_constraint.reset(new btPoint2PointConstraint(bt_body, nPivot));
|
||||||
|
// btVector3 pivotA = bt_body.getCenterOfMassPosition();
|
||||||
|
// m_constraint.reset(new btPoint2PointConstraint(bt_body, -pivotA));
|
||||||
rb->add_constraint(this);
|
rb->add_constraint(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bt_nail_constraint_t(rigid_body_impl_t* rbA, rigid_body_impl_t* rbB, vec3f const& pivot):
|
||||||
|
nail_constraint_impl_t()
|
||||||
|
{
|
||||||
|
btVector3 pivotW(pivot[0], pivot[1], pivot[2]);
|
||||||
|
btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body();
|
||||||
|
const btTransform& trA = bt_bodyA.getCenterOfMassTransform();
|
||||||
|
btTransform iTrA = trA.inverse();
|
||||||
|
btVector3 nPivotA = iTrA * pivotW;
|
||||||
|
btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body();
|
||||||
|
const btTransform& trB = bt_bodyB.getCenterOfMassTransform();
|
||||||
|
btTransform iTrB = trB.inverse();
|
||||||
|
btVector3 nPivotB = iTrB * pivotW;
|
||||||
|
m_constraint.reset(new btPoint2PointConstraint(bt_bodyA, bt_bodyB, nPivotA, nPivotB));
|
||||||
|
rbA->add_constraint(this);
|
||||||
|
rbB->add_constraint(this);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_sixdof_constraint.h
|
//bt_sixdof_constraint.h
|
||||||
@@ -94,7 +98,7 @@ public:
|
|||||||
*/ p = world;
|
*/ p = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void update_constraint()
|
virtual void update_constraint(rigid_body_impl_t* rb)
|
||||||
{
|
{
|
||||||
btGeneric6DofConstraint* constraint = static_cast<btGeneric6DofConstraint*>(m_constraint.get());
|
btGeneric6DofConstraint* constraint = static_cast<btGeneric6DofConstraint*>(m_constraint.get());
|
||||||
constraint->getFrameOffsetA() = constraint->getRigidBodyA().getCenterOfMassTransform().inverse();
|
constraint->getFrameOffsetA() = constraint->getRigidBodyA().getCenterOfMassTransform().inverse();
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//bt_slider_constraint.h
|
//bt_slider_constraint.h
|
||||||
@@ -95,7 +99,7 @@ public:
|
|||||||
*/ p = world;
|
*/ p = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void update_constraint()
|
virtual void update_constraint(rigid_body_impl_t* rb)
|
||||||
{
|
{
|
||||||
/* btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body();
|
/* btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body();
|
||||||
btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body();
|
btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body();
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//nailConstraintNode.cpp
|
//nailConstraintNode.cpp
|
||||||
@@ -43,7 +47,8 @@ Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
|||||||
MTypeId nailConstraintNode::typeId(0x10033A);
|
MTypeId nailConstraintNode::typeId(0x10033A);
|
||||||
MString nailConstraintNode::typeName("dNailConstraint");
|
MString nailConstraintNode::typeName("dNailConstraint");
|
||||||
|
|
||||||
MObject nailConstraintNode::ia_rigidBody;
|
MObject nailConstraintNode::ia_rigidBodyA;
|
||||||
|
MObject nailConstraintNode::ia_rigidBodyB;
|
||||||
MObject nailConstraintNode::ia_damping;
|
MObject nailConstraintNode::ia_damping;
|
||||||
MObject nailConstraintNode::ca_constraint;
|
MObject nailConstraintNode::ca_constraint;
|
||||||
MObject nailConstraintNode::ca_constraintParam;
|
MObject nailConstraintNode::ca_constraintParam;
|
||||||
@@ -56,10 +61,15 @@ MStatus nailConstraintNode::initialize()
|
|||||||
MFnNumericAttribute fnNumericAttr;
|
MFnNumericAttribute fnNumericAttr;
|
||||||
MFnMatrixAttribute fnMatrixAttr;
|
MFnMatrixAttribute fnMatrixAttr;
|
||||||
|
|
||||||
ia_rigidBody = fnMsgAttr.create("inRigidBody", "inrb", &status);
|
ia_rigidBodyA = fnMsgAttr.create("inRigidBodyA", "inrbA", &status);
|
||||||
MCHECKSTATUS(status, "creating inRigidBody attribute")
|
MCHECKSTATUS(status, "creating inRigidBodyA attribute")
|
||||||
status = addAttribute(ia_rigidBody);
|
status = addAttribute(ia_rigidBodyA);
|
||||||
MCHECKSTATUS(status, "adding inRigidBody attribute")
|
MCHECKSTATUS(status, "adding inRigidBodyA attribute")
|
||||||
|
|
||||||
|
ia_rigidBodyB = fnMsgAttr.create("inRigidBodyB", "inrbB", &status);
|
||||||
|
MCHECKSTATUS(status, "creating inRigidBodyB attribute")
|
||||||
|
status = addAttribute(ia_rigidBodyB);
|
||||||
|
MCHECKSTATUS(status, "adding inRigidBodyB attribute")
|
||||||
|
|
||||||
ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status);
|
ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status);
|
||||||
MCHECKSTATUS(status, "creating damping attribute")
|
MCHECKSTATUS(status, "creating damping attribute")
|
||||||
@@ -86,11 +96,17 @@ MStatus nailConstraintNode::initialize()
|
|||||||
MCHECKSTATUS(status, "adding ca_constraintParam attribute")
|
MCHECKSTATUS(status, "adding ca_constraintParam attribute")
|
||||||
|
|
||||||
|
|
||||||
status = attributeAffects(ia_rigidBody, ca_constraint);
|
status = attributeAffects(ia_rigidBodyA, ca_constraint);
|
||||||
MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraint)")
|
MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraint)")
|
||||||
|
|
||||||
status = attributeAffects(ia_rigidBody, ca_constraintParam);
|
status = attributeAffects(ia_rigidBodyA, ca_constraintParam);
|
||||||
MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraintParam)")
|
MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraintParam)")
|
||||||
|
|
||||||
|
status = attributeAffects(ia_rigidBodyB, ca_constraint);
|
||||||
|
MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraint)")
|
||||||
|
|
||||||
|
status = attributeAffects(ia_rigidBodyB, ca_constraintParam);
|
||||||
|
MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraintParam)")
|
||||||
|
|
||||||
status = attributeAffects(ia_damping, ca_constraintParam);
|
status = attributeAffects(ia_damping, ca_constraintParam);
|
||||||
MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)")
|
MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)")
|
||||||
@@ -174,19 +190,34 @@ void nailConstraintNode::draw( M3dView & view, const MDagPath &path,
|
|||||||
( style != M3dView::kGouraudShaded && style != M3dView::kFlatShaded )) ) {
|
( style != M3dView::kGouraudShaded && style != M3dView::kFlatShaded )) ) {
|
||||||
glColor3f(1.0, 1.0, 0.0);
|
glColor3f(1.0, 1.0, 0.0);
|
||||||
}
|
}
|
||||||
vec3f pos;
|
vec3f posA, posB;
|
||||||
|
rigid_body_t::pointer rigid_bodyB = NULL;
|
||||||
if (m_constraint) {
|
if (m_constraint) {
|
||||||
vec3f world;
|
vec3f world;
|
||||||
m_constraint->get_world(world);
|
m_constraint->get_world(world);
|
||||||
vec3f posA;
|
vec3f posT;
|
||||||
quatf rotA;
|
quatf rotT;
|
||||||
m_constraint->rigid_body()->get_transform(posA, rotA);
|
m_constraint->rigid_bodyA()->get_transform(posT, rotT);
|
||||||
pos = posA - world;
|
posA = posT - world;
|
||||||
|
rigid_bodyB = m_constraint->rigid_bodyB();
|
||||||
|
if(rigid_bodyB)
|
||||||
|
{
|
||||||
|
rigid_bodyB->get_transform(posT, rotT);
|
||||||
|
posB = posT - world;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
|
|
||||||
glVertex3f(0.0, 0.0, 0.0);
|
glVertex3f(0.0, 0.0, 0.0);
|
||||||
glVertex3f(pos[0], pos[1], pos[2]);
|
glVertex3f(posA[0], posA[1], posA[2]);
|
||||||
|
|
||||||
|
if(rigid_bodyB)
|
||||||
|
{
|
||||||
|
glVertex3f(0.0, 0.0, 0.0);
|
||||||
|
glVertex3f(posB[0], posB[1], posB[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
glVertex3f(-1.0, 0.0, 0.0);
|
glVertex3f(-1.0, 0.0, 0.0);
|
||||||
glVertex3f(1.0, 0.0, 0.0);
|
glVertex3f(1.0, 0.0, 0.0);
|
||||||
@@ -225,35 +256,83 @@ void nailConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data)
|
|||||||
// std::cout << "nailConstraintNode::computeConstraint" << std::endl;
|
// std::cout << "nailConstraintNode::computeConstraint" << std::endl;
|
||||||
|
|
||||||
MObject thisObject(thisMObject());
|
MObject thisObject(thisMObject());
|
||||||
MPlug plgRigidBody(thisObject, ia_rigidBody);
|
MPlug plgRigidBodyA(thisObject, ia_rigidBodyA);
|
||||||
|
MPlug plgRigidBodyB(thisObject, ia_rigidBodyB);
|
||||||
MObject update;
|
MObject update;
|
||||||
//force evaluation of the rigidBody
|
//force evaluation of the rigidBody
|
||||||
plgRigidBody.getValue(update);
|
plgRigidBodyA.getValue(update);
|
||||||
|
plgRigidBodyB.getValue(update);
|
||||||
|
|
||||||
rigid_body_t::pointer rigid_body;
|
rigid_body_t::pointer rigid_bodyA;
|
||||||
if(plgRigidBody.isConnected()) {
|
if(plgRigidBodyA.isConnected()) {
|
||||||
MPlugArray connections;
|
MPlugArray connections;
|
||||||
plgRigidBody.connectedTo(connections, true, true);
|
plgRigidBodyA.connectedTo(connections, true, true);
|
||||||
if(connections.length() != 0) {
|
if(connections.length() != 0) {
|
||||||
MFnDependencyNode fnNode(connections[0].node());
|
MFnDependencyNode fnNode(connections[0].node());
|
||||||
if(fnNode.typeId() == rigidBodyNode::typeId) {
|
if(fnNode.typeId() == rigidBodyNode::typeId) {
|
||||||
rigidBodyNode *pRigidBodyNode = static_cast<rigidBodyNode*>(fnNode.userNode());
|
rigidBodyNode *pRigidBodyNodeA = static_cast<rigidBodyNode*>(fnNode.userNode());
|
||||||
rigid_body = pRigidBodyNode->rigid_body();
|
rigid_bodyA = pRigidBodyNodeA->rigid_body();
|
||||||
} else {
|
} else {
|
||||||
std::cout << "nailConstraintNode connected to a non-rigidbody node!" << std::endl;
|
std::cout << "nailConstraintNode connected to a non-rigidbody node A!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rigid_body) {
|
rigid_body_t::pointer rigid_bodyB;
|
||||||
|
if(plgRigidBodyB.isConnected()) {
|
||||||
|
MPlugArray connections;
|
||||||
|
plgRigidBodyB.connectedTo(connections, true, true);
|
||||||
|
if(connections.length() != 0) {
|
||||||
|
MFnDependencyNode fnNode(connections[0].node());
|
||||||
|
if(fnNode.typeId() == rigidBodyNode::typeId) {
|
||||||
|
rigidBodyNode *pRigidBodyNodeB = static_cast<rigidBodyNode*>(fnNode.userNode());
|
||||||
|
rigid_bodyB = pRigidBodyNodeB->rigid_body();
|
||||||
|
} else {
|
||||||
|
std::cout << "nailConstraintNode connected to a non-rigidbody node B!" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if((rigid_bodyA != NULL) && (rigid_bodyB != NULL))
|
||||||
|
{
|
||||||
|
constraint_t::pointer constraint = static_cast<constraint_t::pointer>(m_constraint);
|
||||||
|
solver_t::remove_constraint(constraint);
|
||||||
|
vec3f posA, posB, posP;
|
||||||
|
quatf rotA, rotB;
|
||||||
|
rigid_bodyA->get_transform(posA, rotA);
|
||||||
|
rigid_bodyB->get_transform(posB, rotB);
|
||||||
|
posP = posA;
|
||||||
|
m_constraint = solver_t::create_nail_constraint(rigid_bodyA, rigid_bodyB, posP);
|
||||||
|
constraint = static_cast<constraint_t::pointer>(m_constraint);
|
||||||
|
solver_t::add_constraint(constraint);
|
||||||
|
}
|
||||||
|
else if(rigid_bodyA)
|
||||||
|
{
|
||||||
//not connected to a rigid body, put a default one
|
//not connected to a rigid body, put a default one
|
||||||
constraint_t::pointer constraint = static_cast<constraint_t::pointer>(m_constraint);
|
constraint_t::pointer constraint = static_cast<constraint_t::pointer>(m_constraint);
|
||||||
solver_t::remove_constraint(constraint);
|
solver_t::remove_constraint(constraint);
|
||||||
m_constraint = solver_t::create_nail_constraint(rigid_body);
|
vec3f posA, posP;
|
||||||
|
quatf rotA;
|
||||||
|
rigid_bodyA->get_transform(posA, rotA);
|
||||||
|
posP = posA;
|
||||||
|
m_constraint = solver_t::create_nail_constraint(rigid_bodyA, posP);
|
||||||
constraint = static_cast<constraint_t::pointer>(m_constraint);
|
constraint = static_cast<constraint_t::pointer>(m_constraint);
|
||||||
solver_t::add_constraint(constraint);
|
solver_t::add_constraint(constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MFnDagNode mDagNode(thisObject);
|
||||||
|
if(mDagNode.parentCount() == 0)
|
||||||
|
{
|
||||||
|
std::cout << "No transform for nail constraint found!" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MFnTransform mTransform(mDagNode.parent(0));
|
||||||
|
vec3f constrPos;
|
||||||
|
m_constraint->get_world(constrPos);
|
||||||
|
mTransform.setTranslation(MVector(constrPos[0], constrPos[1], constrPos[2]), MSpace::kTransform);
|
||||||
|
}
|
||||||
|
|
||||||
data.outputValue(ca_constraint).set(true);
|
data.outputValue(ca_constraint).set(true);
|
||||||
data.setClean(plug);
|
data.setClean(plug);
|
||||||
}
|
}
|
||||||
@@ -293,7 +372,14 @@ void nailConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data)
|
|||||||
std::cout << "pivot (" << pivot[0] << "," << pivot[0] << "," << pivot[0] << ")" << std::endl;
|
std::cout << "pivot (" << pivot[0] << "," << pivot[0] << "," << pivot[0] << ")" << std::endl;
|
||||||
*/
|
*/
|
||||||
// std::cout << "mtranslation (" << mtranslation[0] << "," << mtranslation[0] << "," << mtranslation[0] << ")" << std::endl;
|
// std::cout << "mtranslation (" << mtranslation[0] << "," << mtranslation[0] << "," << mtranslation[0] << ")" << std::endl;
|
||||||
m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2]));
|
float deltaX = world[0] - float(mtranslation.x);
|
||||||
|
float deltaY = world[1] - float(mtranslation.y);
|
||||||
|
float deltaZ = world[2] - float(mtranslation.z);
|
||||||
|
float deltaSq = deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ;
|
||||||
|
if(deltaSq > 0.000001f)
|
||||||
|
{
|
||||||
|
m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//nailConstraintNode.h
|
//nailConstraintNode.h
|
||||||
@@ -66,7 +70,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
static MObject ia_rigidBody;
|
static MObject ia_rigidBodyA;
|
||||||
|
static MObject ia_rigidBodyB;
|
||||||
static MObject ia_damping;
|
static MObject ia_damping;
|
||||||
|
|
||||||
static MObject ca_constraint;
|
static MObject ca_constraint;
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//nail_constraint.h
|
//nail_constraint.h
|
||||||
@@ -39,7 +43,8 @@ public:
|
|||||||
typedef shared_ptr<nail_constraint_t> pointer;
|
typedef shared_ptr<nail_constraint_t> pointer;
|
||||||
|
|
||||||
//
|
//
|
||||||
rigid_body_t::pointer rigid_body() { return m_rigid_body; }
|
rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; }
|
||||||
|
rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; }
|
||||||
|
|
||||||
//
|
//
|
||||||
void set_pivotA(vec3f const& p) {
|
void set_pivotA(vec3f const& p) {
|
||||||
@@ -81,14 +86,23 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class solver_t;
|
friend class solver_t;
|
||||||
nail_constraint_t(nail_constraint_impl_t* impl, rigid_body_t::pointer& rigid_body):
|
nail_constraint_t(nail_constraint_impl_t* impl, rigid_body_t::pointer& rigid_bodyA):
|
||||||
constraint_t(impl),
|
constraint_t(impl),
|
||||||
m_rigid_body(rigid_body)
|
m_rigid_bodyA(rigid_bodyA),
|
||||||
|
m_rigid_bodyB(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
nail_constraint_t(nail_constraint_impl_t* impl, rigid_body_t::pointer& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB):
|
||||||
|
constraint_t(impl),
|
||||||
|
m_rigid_bodyA(rigid_bodyA),
|
||||||
|
m_rigid_bodyB(rigid_bodyB)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rigid_body_t::pointer m_rigid_body;
|
rigid_body_t::pointer m_rigid_bodyA;
|
||||||
|
rigid_body_t::pointer m_rigid_bodyB;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//dSolverNode.cpp
|
//dSolverNode.cpp
|
||||||
@@ -49,6 +53,7 @@ Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
|||||||
#include "solver.h"
|
#include "solver.h"
|
||||||
#include "rigidBodyNode.h"
|
#include "rigidBodyNode.h"
|
||||||
#include "rigidBodyArrayNode.h"
|
#include "rigidBodyArrayNode.h"
|
||||||
|
#include "constraint/nailConstraintNode.h"
|
||||||
#include "pdbIO.h"
|
#include "pdbIO.h"
|
||||||
|
|
||||||
MTypeId dSolverNode::typeId(0x100331);
|
MTypeId dSolverNode::typeId(0x100331);
|
||||||
@@ -357,6 +362,7 @@ void dSolverNode::initRigidBodies(MPlugArray &rbConnections)
|
|||||||
|
|
||||||
if(fnNode.typeId() == rigidBodyNode::typeId) {
|
if(fnNode.typeId() == rigidBodyNode::typeId) {
|
||||||
initRigidBody(node);
|
initRigidBody(node);
|
||||||
|
updateConstraint(node);
|
||||||
} else if(fnNode.typeId() == rigidBodyArrayNode::typeId) {
|
} else if(fnNode.typeId() == rigidBodyArrayNode::typeId) {
|
||||||
initRigidBodyArray(node);
|
initRigidBodyArray(node);
|
||||||
}
|
}
|
||||||
@@ -491,6 +497,34 @@ void dSolverNode::updatePassiveRigidBodies(MPlugArray &rbConnections, std::vecto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dSolverNode::updateConstraint(MObject& bodyNode)
|
||||||
|
{
|
||||||
|
MFnDagNode fnDagNode(bodyNode);
|
||||||
|
rigidBodyNode *rbNode = static_cast<rigidBodyNode*>(fnDagNode.userNode());
|
||||||
|
MPlug plgMessages(bodyNode, rbNode->message);
|
||||||
|
MPlugArray rbMsgConnections;
|
||||||
|
plgMessages.connectedTo(rbMsgConnections, false, true);
|
||||||
|
for(size_t j = 0; j < rbMsgConnections.length(); j++)
|
||||||
|
{
|
||||||
|
MObject msgNode = rbMsgConnections[j].node();
|
||||||
|
MFnDagNode msgDagNode(msgNode);
|
||||||
|
if(msgDagNode.typeId() == nailConstraintNode::typeId)
|
||||||
|
{
|
||||||
|
nailConstraintNode* nailNode = static_cast<nailConstraintNode*>(msgDagNode.userNode());
|
||||||
|
if(msgDagNode.parentCount() == 0)
|
||||||
|
{
|
||||||
|
std::cout << "No transform for nail constraint found!" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MFnTransform msgTransform(msgDagNode.parent(0));
|
||||||
|
nail_constraint_t::pointer nail = nailNode->constraint();
|
||||||
|
vec3f constrPos;
|
||||||
|
nail->get_world(constrPos);
|
||||||
|
msgTransform.setTranslation(MVector(constrPos[0], constrPos[1], constrPos[2]), MSpace::kTransform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//update the scene after a simulation step
|
//update the scene after a simulation step
|
||||||
void dSolverNode::updateActiveRigidBodies(MPlugArray &rbConnections)
|
void dSolverNode::updateActiveRigidBodies(MPlugArray &rbConnections)
|
||||||
{
|
{
|
||||||
@@ -520,6 +554,7 @@ void dSolverNode::updateActiveRigidBodies(MPlugArray &rbConnections)
|
|||||||
fnTransform.setRotation(MQuaternion(rot[1], rot[2], rot[3], rot[0]));
|
fnTransform.setRotation(MQuaternion(rot[1], rot[2], rot[3], rot[0]));
|
||||||
fnTransform.setTranslation(MVector(pos[0], pos[1], pos[2]), MSpace::kTransform);
|
fnTransform.setTranslation(MVector(pos[0], pos[1], pos[2]), MSpace::kTransform);
|
||||||
}
|
}
|
||||||
|
updateConstraint(node);
|
||||||
} else if(fnDagNode.typeId() == rigidBodyArrayNode::typeId) {
|
} else if(fnDagNode.typeId() == rigidBodyArrayNode::typeId) {
|
||||||
rigidBodyArrayNode *rbNode = static_cast<rigidBodyArrayNode*>(fnDagNode.userNode());
|
rigidBodyArrayNode *rbNode = static_cast<rigidBodyArrayNode*>(fnDagNode.userNode());
|
||||||
std::vector<rigid_body_t::pointer>& rbs = rbNode->rigid_bodies();
|
std::vector<rigid_body_t::pointer>& rbs = rbNode->rigid_bodies();
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//dSolverNode.h
|
//dSolverNode.h
|
||||||
@@ -83,6 +87,7 @@ protected:
|
|||||||
void updatePassiveRigidBodies(MPlugArray &rbConnections, std::vector<xforms_t> &xforms, float t);
|
void updatePassiveRigidBodies(MPlugArray &rbConnections, std::vector<xforms_t> &xforms, float t);
|
||||||
void updateActiveRigidBodies(MPlugArray &rbConnections);
|
void updateActiveRigidBodies(MPlugArray &rbConnections);
|
||||||
void applyFields(MPlugArray &rbConnections, float dt);
|
void applyFields(MPlugArray &rbConnections, float dt);
|
||||||
|
void updateConstraint(MObject& bodyNode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MTime m_prevTime;
|
MTime m_prevTime;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
xcopy /S /Y /C /I /h icons\*.xpm "C:\Program Files\Autodesk\Maya2008\icons"
|
xcopy /S /Y /C /I /h icons\*.xpm "C:\Program Files\Autodesk\Maya8.5\icons"
|
||||||
xcopy /S /Y /C /I /h scripts\*.mel "C:\Program Files\Autodesk\Maya2008\scripts"
|
xcopy /S /Y /C /I /h scripts\*.mel "C:\Program Files\Autodesk\Maya8.5\scripts"
|
||||||
xcopy /S /Y /C /I /h BulletMayaPluginDebug.mll "C:\Program Files\Autodesk\Maya2008\bin\plug-ins"
|
xcopy /S /Y /C /I /h BulletMayaPluginDebug.mll "C:\Program Files\Autodesk\Maya8.5\bin\plug-ins"
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//mesh_shape.h
|
//mesh_shape.h
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//AEdNailConstraintTemplate.mel
|
//AEdNailConstraintTemplate.mel
|
||||||
@@ -28,7 +32,8 @@ global proc AEdNailConstraintTemplate( string $nodeName )
|
|||||||
editorTemplate -beginScrollLayout;
|
editorTemplate -beginScrollLayout;
|
||||||
|
|
||||||
editorTemplate -addControl damping;
|
editorTemplate -addControl damping;
|
||||||
editorTemplate -addControl inRigidBody;
|
editorTemplate -addControl inRigidBodyA;
|
||||||
|
editorTemplate -addControl inRigidBodyB;
|
||||||
|
|
||||||
AEdependNodeTemplate $nodeName;
|
AEdependNodeTemplate $nodeName;
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//dynamicaUI.mel
|
//dynamicaUI.mel
|
||||||
@@ -688,21 +692,40 @@ global proc dynamicaUI_createPassiveMeshRBArray()
|
|||||||
global proc dynamicaUI_createNailConstraint()
|
global proc dynamicaUI_createNailConstraint()
|
||||||
{
|
{
|
||||||
string $selection[] = `ls -selection -dag -leaf -showType -type "geometry"`;
|
string $selection[] = `ls -selection -dag -leaf -showType -type "geometry"`;
|
||||||
|
|
||||||
//create dSolver node if necessary
|
//create dSolver node if necessary
|
||||||
dSolver;
|
dSolver;
|
||||||
|
// check selection in scene : one or two rigidBodies should be selected
|
||||||
string $newConstraints[];
|
int $selSize = size($selection);
|
||||||
for($i = 0; $i < size($selection) / 2; $i++) {
|
int $selOK = (($selSize == 2) || ($selSize == 4));
|
||||||
if($selection[$i * 2 + 1] == "dRigidBody") {
|
for($i = 0; $i < $selSize/2; $i++)
|
||||||
string $constraintNode = `dNailConstraint`;
|
{
|
||||||
connectAttr ($selection[$i * 2] + ".message") ($constraintNode + ".inRigidBody");
|
if($selection[$i * 2 + 1] != "dRigidBody")
|
||||||
string $constraintTransforms[] = `listRelatives -parent $constraintNode`;
|
{
|
||||||
$newConstraints[$i] = $constraintTransforms[0];
|
$selOK = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(!$selOK)
|
||||||
|
{
|
||||||
|
error("Select one or two bodies to create a nail constraint");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// create nail constraint node
|
||||||
|
string $constraintNode = `dNailConstraint`;
|
||||||
|
// connect to bodies
|
||||||
|
if($selSize == 2)
|
||||||
|
{
|
||||||
|
connectAttr ($selection[0] + ".message") ($constraintNode + ".inRigidBodyA");
|
||||||
}
|
}
|
||||||
select -r $newConstraints;
|
else
|
||||||
|
{
|
||||||
|
connectAttr ($selection[0] + ".message") ($constraintNode + ".inRigidBodyA");
|
||||||
|
connectAttr ($selection[2] + ".message") ($constraintNode + ".inRigidBodyB");
|
||||||
|
}
|
||||||
|
string $constraintTransforms[] = `listRelatives -parent $constraintNode`;
|
||||||
|
string $newConstraint = $constraintTransforms[0];
|
||||||
|
select -r $newConstraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
global proc dynamicaUI_createHingeConstraint()
|
global proc dynamicaUI_createHingeConstraint()
|
||||||
{
|
{
|
||||||
string $selection[] = `ls -selection -dag -leaf -showType -type "geometry"`;
|
string $selection[] = `ls -selection -dag -leaf -showType -type "geometry"`;
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//solver.cpp
|
//solver.cpp
|
||||||
@@ -89,6 +93,10 @@ nail_constraint_t::pointer solver_t::create_nail_constraint(rigid_body_t::point
|
|||||||
{
|
{
|
||||||
return nail_constraint_t::pointer(new nail_constraint_t(m_impl->create_nail_constraint(rb->impl(), pivot), rb));
|
return nail_constraint_t::pointer(new nail_constraint_t(m_impl->create_nail_constraint(rb->impl(), pivot), rb));
|
||||||
}
|
}
|
||||||
|
nail_constraint_t::pointer solver_t::create_nail_constraint(rigid_body_t::pointer& rbA, rigid_body_t::pointer& rbB, vec3f const& pivot)
|
||||||
|
{
|
||||||
|
return nail_constraint_t::pointer(new nail_constraint_t(m_impl->create_nail_constraint(rbA->impl(), rbB->impl(), pivot), rbA, rbB));
|
||||||
|
}
|
||||||
hinge_constraint_t::pointer solver_t::create_hinge_constraint(rigid_body_t::pointer& rb, vec3f const& pivot)
|
hinge_constraint_t::pointer solver_t::create_hinge_constraint(rigid_body_t::pointer& rb, vec3f const& pivot)
|
||||||
{
|
{
|
||||||
return hinge_constraint_t::pointer(new hinge_constraint_t(m_impl->create_hinge_constraint(rb->impl(), pivot), rb));
|
return hinge_constraint_t::pointer(new hinge_constraint_t(m_impl->create_hinge_constraint(rb->impl(), pivot), rb));
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//solver.h
|
//solver.h
|
||||||
@@ -69,6 +73,7 @@ public:
|
|||||||
static rigid_body_t::pointer create_rigid_body(collision_shape_t::pointer& cs);
|
static rigid_body_t::pointer create_rigid_body(collision_shape_t::pointer& cs);
|
||||||
|
|
||||||
static nail_constraint_t::pointer create_nail_constraint(rigid_body_t::pointer& rb, vec3f const& pivot = vec3f(0, 0, 0));
|
static nail_constraint_t::pointer create_nail_constraint(rigid_body_t::pointer& rb, vec3f const& pivot = vec3f(0, 0, 0));
|
||||||
|
static nail_constraint_t::pointer create_nail_constraint(rigid_body_t::pointer& rbA, rigid_body_t::pointer& rbB, vec3f const& pivot = vec3f(0, 0, 0));
|
||||||
static hinge_constraint_t::pointer create_hinge_constraint(rigid_body_t::pointer& rb, vec3f const& pivot = vec3f(0, 0, 0));
|
static hinge_constraint_t::pointer create_hinge_constraint(rigid_body_t::pointer& rb, vec3f const& pivot = vec3f(0, 0, 0));
|
||||||
static slider_constraint_t::pointer create_slider_constraint(rigid_body_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f const& pivotB = vec3f(0, 0, 0));
|
static slider_constraint_t::pointer create_slider_constraint(rigid_body_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f const& pivotB = vec3f(0, 0, 0));
|
||||||
static sixdof_constraint_t::pointer create_sixdof_constraint(rigid_body_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f const& pivotB = vec3f(0, 0, 0));
|
static sixdof_constraint_t::pointer create_sixdof_constraint(rigid_body_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f const& pivotB = vec3f(0, 0, 0));
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ not be misrepresented as being the original software.
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||||
|
|
||||||
|
Modified by Roman Ponomarev <rponom@gmail.com>
|
||||||
|
12/24/2009 : Nail constraint improvements
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//solver_impl.h
|
//solver_impl.h
|
||||||
@@ -53,6 +57,7 @@ public:
|
|||||||
virtual rigid_body_impl_t* create_rigid_body(collision_shape_impl_t* cs) = 0;
|
virtual rigid_body_impl_t* create_rigid_body(collision_shape_impl_t* cs) = 0;
|
||||||
|
|
||||||
virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_t* rb, vec3f const& pivot) = 0;
|
virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_t* rb, vec3f const& pivot) = 0;
|
||||||
|
virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_t* rbA, rigid_body_impl_t* rbB, vec3f const& pivot) = 0;
|
||||||
virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_impl_t* rb, vec3f const& pivot) = 0;
|
virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_impl_t* rb, vec3f const& pivot) = 0;
|
||||||
virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB) = 0;
|
virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB) = 0;
|
||||||
virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB) = 0;
|
virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB) = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user