This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru
|
||||
Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using Microsoft.Xna.Framework.Storage;
|
||||
#endregion
|
||||
using XnaDevRu.BulletX;
|
||||
using XnaDevRu.BulletX.Dynamics;
|
||||
|
||||
namespace XnaDevRu.BulletX.Demos.Ccd
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the main type for your game
|
||||
/// </summary>
|
||||
public class CcdDemo : XnaDevRu.BulletX.Demos.DemoGame
|
||||
{
|
||||
public CcdDemo()
|
||||
{
|
||||
NumObjects = 120;
|
||||
|
||||
Shapes[0] = new BoxShape(new Vector3(200, 10, 200));
|
||||
|
||||
for (int i = 0; i < NumObjects; i++)
|
||||
{
|
||||
CollisionShape shape = Shapes[ShapeIndex[i]];
|
||||
shape.Margin = CollisionMargin;
|
||||
|
||||
bool isDynamic = i > 0;
|
||||
|
||||
Matrix trans = Matrix.Identity;
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
//stack them
|
||||
int colsize = 10;
|
||||
int row = (i * HalfExtents * 2) / (colsize * 2 * HalfExtents);
|
||||
int row2 = row;
|
||||
int col = (i) % (colsize) - colsize / 2;
|
||||
|
||||
if (col > 3)
|
||||
{
|
||||
col = 11;
|
||||
row2 |= 1;
|
||||
}
|
||||
|
||||
Vector3 pos;
|
||||
if (NumObjects > 2)
|
||||
{
|
||||
pos = new Vector3(col * 2 * HalfExtents + (row2 % 2) * HalfExtents,
|
||||
row * 2 * HalfExtents + HalfExtents + ExtraHeight, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = new Vector3(0, -30, 0);
|
||||
}
|
||||
|
||||
if (shape is BoxShape)
|
||||
{
|
||||
trans.Right = new Vector3(0, -1, 0);
|
||||
trans.Up = new Vector3(1, 0, 0);
|
||||
trans.Backward = new Vector3(0, 0, 1);
|
||||
}
|
||||
|
||||
trans *= Matrix.CreateRotationZ(Microsoft.Xna.Framework.MathHelper.PiOver2);
|
||||
trans.Translation = pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
trans.Translation = new Vector3(0, -30, 0);
|
||||
}
|
||||
|
||||
float mass = 1.0f;
|
||||
if (!isDynamic)
|
||||
mass = 0.0f;
|
||||
|
||||
RigidBody body = CreateRigidBody(mass, trans, shape);
|
||||
|
||||
body.CcdSquareMotionThreshold = HalfExtents;
|
||||
body.CcdSweptSphereRadius = 0.2f * HalfExtents;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru
|
||||
Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace XnaDevRu.BulletX.Demos.Ccd
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
static void Main(string[] args)
|
||||
{
|
||||
using (CcdDemo game = new CcdDemo())
|
||||
{
|
||||
game.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("XnaDevRu.BulletX.Demos.Ccd")]
|
||||
[assembly: AssemblyProduct("Bullet for XNA")]
|
||||
[assembly: AssemblyDescription("Bullet for XNA CCD Demo")]
|
||||
[assembly: AssemblyCompany("XNADev.ru")]
|
||||
|
||||
[assembly: AssemblyCopyright("Copyright © 2007 XNADev.ru")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("58969560-d588-4200-a57e-2f312cdf6a18")]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.149.21894")]
|
||||
@@ -0,0 +1,93 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{705FCCF1-44C8-430E-92A9-9987CD3D6A64}</ProjectGuid>
|
||||
<ProjectTypeGuids>{9F340DF3-2AED-4330-AC16-78AC2D9B4738};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>XnaDevRu.BulletX.Demos.Ccd</RootNamespace>
|
||||
<AssemblyName>Ccd</AssemblyName>
|
||||
<XnaFrameworkVersion>v1.0</XnaFrameworkVersion>
|
||||
<XnaPlatform>Windows</XnaPlatform>
|
||||
<ApplicationIcon>..\..\..\SharedContent\bullet_ico.ico</ApplicationIcon>
|
||||
<XNAGlobalContentPipelineAssemblies>Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll;Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll;Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll;Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</XNAGlobalContentPipelineAssemblies>
|
||||
<XNAProjectContentPipelineAssemblies>
|
||||
</XNAProjectContentPipelineAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\..\Build\x86\Debug\Demos\BulletX\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\..\Build\x86\Release\Demos\BulletX\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Game">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CcdDemo.cs">
|
||||
<XNAUseContentPipeline>false</XNAUseContentPipeline>
|
||||
<Name>CcdDemo</Name>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Program.cs">
|
||||
<XNAUseContentPipeline>false</XNAUseContentPipeline>
|
||||
<Name>Program</Name>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\XnaDevRu.BulletX.Demos\XnaDevRu.BulletX.Demos.csproj">
|
||||
<Project>{2DF77065-B2FF-4DBB-96BB-A28E09A4A23A}</Project>
|
||||
<Name>XnaDevRu.BulletX.Demos</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\XnaDevRu.BulletX\XnaDevRu.BulletX.csproj">
|
||||
<Project>{EBC5D108-65E5-4F8E-B3F2-BF7EE56C27F3}</Project>
|
||||
<Name>XnaDevRu.BulletX</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\..\SharedContent\bullet_ico.ico">
|
||||
<Link>bullet_ico.ico</Link>
|
||||
<XNAUseContentPipeline>false</XNAUseContentPipeline>
|
||||
<Name>bullet_ico</Name>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA\Game Studio Express\v1.0\Microsoft.Xna.ContentPipeline.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA\Game Studio Express\v1.0\Microsoft.Xna.Common.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user