本文整理汇总了C#中RigidBody.UseUserMassProperties方法的典型用法代码示例。如果您正苦于以下问题:C# RigidBody.UseUserMassProperties方法的具体用法?C# RigidBody.UseUserMassProperties怎么用?C# RigidBody.UseUserMassProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RigidBody
的用法示例。
在下文中一共展示了RigidBody.UseUserMassProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
//.........这里部分代码省略.........
this.ArchesConfig = defaultSC.Clone();
this.ArchesConfig.BackgroundScene = new RgbmCubeMap(textureArches, textureArchesAlpha, this.ArchesConfig.RgbmImageScale);
this.ArchesConfig.SunColour = new Vector3(1, 1, 1);
this.ArchesConfig.SunDirection = Vector3.Normalize(new Vector3(-0.4f, 0.4f, 0.5f));
this.ArchesConfig.SunIntensity = 15.0f;
this.ArchesConfig.DefaultLensExposure = 0.15f;
this.ArchesConfig.DefaultCamPos = new Vector3(-2.667145f, 105.280345f, 4.98485f);
this.ArchesConfig.DefaultCamViewPos = new Vector3(-2.470318f, 105.176862f, 4.009888f);
//this.ArchesConfig.BloomScale = 0f; // temporary bloom disable for wireframe
//setup WaterfrontHDR specifics
this.WaterfrontConfig = defaultSC.Clone();
this.WaterfrontConfig.BackgroundScene = new RgbmCubeMap(textureWaterfront, textureWaterfrontAlpha, this.WaterfrontConfig.RgbmImageScale);
this.WaterfrontConfig.SunColour = new Vector3(0.9f, 0.95f, 1);
this.WaterfrontConfig.SunDirection = Vector3.Normalize(new Vector3(-0.2f, 1, 0));
this.WaterfrontConfig.SunIntensity = 15.0f;
this.WaterfrontConfig.DefaultLensExposure = 0.35f;
this.WaterfrontConfig.DefaultCamPos = new Vector3(5.251021f, 105.877438f, -2.74239f);
this.WaterfrontConfig.DefaultCamViewPos = new Vector3(4.579107f, 105.783906f, -2.007691f);
//setup MillHDR specifics
this.MillConfig = defaultSC.Clone();
this.MillConfig.BackgroundScene = new RgbmCubeMap(textureMill, textureMillAlpha, this.MillConfig.RgbmImageScale);
this.MillConfig.SunColour = new Vector3(1, 0.975f, 0.95f);
this.MillConfig.SunDirection = Vector3.Normalize(new Vector3(-1, 1, -1));
this.MillConfig.SunIntensity = 25.0f;
this.MillConfig.DefaultLensExposure = 0.5f;
this.MillConfig.BloomScale = 0.5f;
this.MillConfig.BloomThreshold = 1.0f;
this.MillConfig.DefaultCamPos = new Vector3(6.087461f, 105.132507f, -0.8147218f);
this.MillConfig.DefaultCamViewPos = new Vector3(5.203656f, 104.989332f, -0.3693113f);
this.sceneConfig = this.ArchesConfig;
this.viewCamera.LookAt(this.sceneConfig.DefaultCamViewPos, this.sceneConfig.DefaultCamPos, new Vector3(0, 1, 0));
//Textures are no longer needed.
localManager.Dispose();
localManager = new ContentManager(this.Services, state.ContentRegister.RootDirectory);
// Generate terrain
/*
const int terrainSeed = 70;
GenerateTerrain(terrainSeed);
terrainManager.SideColor = localManager.Load<Texture2D>("TerrainTextures/cliffs2");
terrainManager.BottomColor = localManager.Load<Texture2D>("TerrainTextures/rock1");
terrainManager.TopColor = localManager.Load<Texture2D>("TerrainTextures/grassyrock2");
terrainManager.SideNormal = localManager.Load<Texture2D>("TerrainTextures/rock_normal");
terrainManager.TopNormal = terrainManager.SideNormal;
terrainManager.BottomNormal = terrainManager.SideNormal;
terrainManager.terrainShader.SideColor = terrainManager.SideColor;
terrainManager.terrainShader.SideNormal = terrainManager.SideNormal;
terrainManager.terrainShader.BottomColor = terrainManager.BottomColor;
terrainManager.terrainShader.BottomNormal = terrainManager.BottomNormal;
terrainManager.terrainShader.TopColor = terrainManager.TopColor;
terrainManager.terrainShader.TopNormal = terrainManager.TopNormal;
terrainManager.terrainShader.TextureScale = 0.1f + ((1 / terrainManager.cellDimensions.X) / 2.5f);
SetupTerrainShader();
*/
// xpf gui initialisation
/*
Microsoft.Xna.Framework.Game g = (Microsoft.Xna.Framework.Game)this;
this.spriteBatchAdapter = new SpriteBatchAdapter(new SpriteBatch(g.GraphicsDevice));
var primitivesService = new PrimitivesService(g.GraphicsDevice);
var renderer = new Renderer(this.spriteBatchAdapter, primitivesService);
this.rootElement = new RootElement(g.GraphicsDevice.Viewport.ToRect(), renderer);
var spriteFontAdapter = new SpriteFontAdapter(arial);
var textBlock = new TextBlock(spriteFontAdapter)
{
Text = "Hello from XPF!",
Foreground = new RedBadger.Xpf.Media.SolidColorBrush(RedBadger.Xpf.Media.Colors.White),
//Background = new RedBadger.Xpf.Media.SolidColorBrush(RedBadger.Xpf.Media.Colors.Red),
HorizontalAlignment = RedBadger.Xpf.HorizontalAlignment.Left,
VerticalAlignment = RedBadger.Xpf.VerticalAlignment.Top
};
this.rootElement.Content = textBlock;*/
// calculate physics for terrain and add it
simpleTerrain.CalculatePhysicsHull();
world.AddBody(simpleTerrain.RigidBody);
// add player model to physics sim
float height = model.ModelData.StaticBounds.Maximum.Y - model.ModelData.StaticBounds.Minimum.Y;
float width = model.ModelData.StaticBounds.Maximum.X - model.ModelData.StaticBounds.Minimum.X;
RigidBody playerBody = new RigidBody(new CapsuleShape(0.16f, 0.08f));
playerBody.Position = new JVector(0, 100, 0);
playerBody.UseUserMassProperties(JMatrix.Zero, 1.0f, true);
playerBody.Restitution = 0.0f;
//playerBody.Orientation = Matrix.CreateRotationZ(MathHelper.Pi).ToJitterMatrix();
characterController = new CharacterController(world, playerBody);
world.AddBody(playerBody);
world.AddConstraint(characterController);
}