本文整理汇总了C#中BulletSharp.RigidBody.SetDamping方法的典型用法代码示例。如果您正苦于以下问题:C# RigidBody.SetDamping方法的具体用法?C# RigidBody.SetDamping怎么用?C# RigidBody.SetDamping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BulletSharp.RigidBody
的用法示例。
在下文中一共展示了RigidBody.SetDamping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FreeCamera
public FreeCamera(float aspectRatio, float fov)
{
Cam = new Camera(new Vector3(20, 20, 20), new Vector3(0, 2, 0), aspectRatio, fov, 0.1f, 10000.0f);
Camera.MainDisplayCamera = Cam;
collisionShape = new SphereShape(0.8f);
//collisionShape.LinearDamping = 0.5f;
rigidBody = World.Root.CreateRigidBody(0.01f, Matrix4.CreateTranslation(Cam.Transformation.GetPosition()), collisionShape, null);
rigidBody.SetSleepingThresholds(0, 0);
rigidBody.ContactProcessingThreshold = 0;
rigidBody.CcdMotionThreshold = 0;
World.Root.PhysicalWorld.AddRigidBody(rigidBody);
rigidBody.Gravity = Vector3.Zero;
rigidBody.ApplyGravity();
rigidBody.SetDamping(0.5f, 0.01f);
GLThread.OnUpdate += UpdateSterring;
GLThread.OnMouseMove += OnMouseMove;
GLThread.OnKeyUp += (o, e) =>
{
if(e.Key == OpenTK.Input.Key.P)
{
GravityEnabled = !GravityEnabled;
if(GravityEnabled)
{
rigidBody.Gravity = new Vector3(0, -9.81f, 0);
rigidBody.ApplyGravity();
rigidBody.SetDamping(0.8f, 0.01f);
}
else
{
rigidBody.Gravity = Vector3.Zero;
rigidBody.ApplyGravity();
rigidBody.SetDamping(0.5f, 0.01f);
}
}
};
}