本文整理汇总了C#中BulletSharp.RigidBody类的典型用法代码示例。如果您正苦于以下问题:C# RigidBody类的具体用法?C# RigidBody怎么用?C# RigidBody使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RigidBody类属于BulletSharp命名空间,在下文中一共展示了RigidBody类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetKartFromBody
public static Kart GetKartFromBody(RigidBody enteredBody)
{
if (enteredBody.UserObject is CollisionObjectDataHolder) {
return (enteredBody.UserObject as CollisionObjectDataHolder).GetThingAsKart();
}
return null;
}
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:7,代码来源:PlayerWrapper.cs
示例2: SolveAngularLimits
public unsafe static float SolveAngularLimits(this RotationalLimitMotor obj, float timeStep, ref OpenTK.Vector3 axis, float jacDiagABInv, RigidBody body0, RigidBody body1)
{
fixed (OpenTK.Vector3* axisPtr = &axis)
{
return obj.SolveAngularLimits(timeStep, ref *(BulletSharp.Math.Vector3*)axisPtr, jacDiagABInv, body0, body1);
}
}
开发者ID:sinkingsugar,项目名称:BulletSharpPInvoke,代码行数:7,代码来源:Generic6DofConstraintExtensions.cs
示例3: OnInitializePhysics
protected override void OnInitializePhysics()
{
CollisionConf = new DefaultCollisionConfiguration();
Dispatcher = new CollisionDispatcher(CollisionConf);
Broadphase = new DbvtBroadphase();
World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConf);
World.Gravity = new Vector3(0, -10, 0);
// ground
CollisionShape groundShape = new BoxShape(50, 1, 50);
CollisionShapes.Add(groundShape);
CollisionObject ground = LocalCreateRigidBody(0, Matrix.Identity, groundShape);
ground.UserObject = "Ground";
// Objects
//colShape = new BoxShape(1);
Vector3[] points0 = {
new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1)
};
Vector3[] points1 = {
new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(0,0,-1), new Vector3(-1,-1,0)
};
colShape0 = new ConvexHullShape(points0);
colShape1 = new ConvexHullShape(points1);
CollisionShapes.Add(colShape0);
CollisionShapes.Add(colShape1);
body2 = LocalCreateRigidBody(0, body2Position, colShape1);
rotBody = LocalCreateRigidBody(0, rotBodyPosition, colShape0);
rotBody.CollisionFlags |= CollisionFlags.KinematicObject;
rotBody.ActivationState = ActivationState.DisableDeactivation;
}
开发者ID:sinkingsugar,项目名称:BulletSharpPInvoke,代码行数:35,代码来源:DistanceDemo.cs
示例4: ApplyMaterial
/// <summary>
/// Only applies friction and bounciness. Use a RigidBodyConstructionInfo if you want to set the damping.
/// </summary>
public void ApplyMaterial(RigidBody body, string material)
{
PhysicsMaterial mat = GetMaterial(material);
body.Friction = mat.Friction;
body.Restitution = mat.Bounciness;
}
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:10,代码来源:PhysicsMaterialFactory.cs
示例5: PhysicalBody
public PhysicalBody(RigidBody rigidBody, CollisionShape shape, TransformationManager manager)
{
Body = rigidBody;
Shape = shape;
Transformation = manager;
Enabled = false;
}
开发者ID:whztt07,项目名称:vengine,代码行数:7,代码来源:PhysicalBody.cs
示例6: HingeConstraint
public HingeConstraint(RigidBody rigidBodyA, Matrix rigidBodyAFrame, bool useReferenceFrameA = false)
: base(btHingeConstraint_new8(rigidBodyA._native, ref rigidBodyAFrame,
useReferenceFrameA))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = GetFixedBody();
}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:7,代码来源:HingeConstraint.cs
示例7: Physics
public Physics()
{
// collision configuration contains default setup for memory, collision setup
collisionConf = new DefaultCollisionConfiguration();
Dispatcher = new CollisionDispatcher(collisionConf);
Broadphase = new DbvtBroadphase();
World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, collisionConf);
World.Gravity = new Vector3(0, -10, 0);
CollisionShapes = new List<CollisionShape>();
// create the ground
CollisionShape groundShape = new BoxShape(50, 1, 50);
CollisionShapes.Add(groundShape);
CollisionObject ground = LocalCreateRigidBody(0, Matrix.Identity, groundShape);
ground.UserObject = "Ground";
// create a few dynamic rigidbodies
float mass = 1.0f;
CollisionShape colShape = new BoxShape(1);
CollisionShapes.Add(colShape);
Vector3 localInertia = colShape.CalculateLocalInertia(mass);
float start_x = StartPosX - ArraySizeX / 2;
float start_y = StartPosY;
float start_z = StartPosZ - ArraySizeZ / 2;
int k, i, j;
for (k = 0; k < ArraySizeY; k++)
{
for (i = 0; i < ArraySizeX; i++)
{
for (j = 0; j < ArraySizeZ; j++)
{
Matrix startTransform = Matrix.CreateTranslation(
new Vector3(
2*i + start_x,
2*k + start_y,
2*j + start_z
)
);
// using motionstate is recommended, it provides interpolation capabilities
// and only synchronizes 'active' objects
DefaultMotionState myMotionState = new DefaultMotionState(startTransform);
RigidBodyConstructionInfo rbInfo =
new RigidBodyConstructionInfo(mass, myMotionState, colShape, localInertia);
RigidBody body = new RigidBody(rbInfo);
// make it drop from a height
body.Translate(new Vector3(0, 20, 0));
World.AddRigidBody(body);
}
}
}
}
开发者ID:jdoyle1983,项目名称:BulletSharp,代码行数:60,代码来源:Physics.cs
示例8: UpdateWheel
public void UpdateWheel(RigidBody chassis, RaycastInfo raycastInfo)
{
if (raycastInfo.IsInContact)
{
float project = Vector3.Dot(raycastInfo.ContactNormalWS, raycastInfo.WheelDirectionWS);
Vector3 chassis_velocity_at_contactPoint;
Vector3 relpos = raycastInfo.ContactPointWS - chassis.CenterOfMassPosition;
chassis_velocity_at_contactPoint = chassis.GetVelocityInLocalPoint(relpos);
float projVel = Vector3.Dot(raycastInfo.ContactNormalWS, chassis_velocity_at_contactPoint);
if (project >= -0.1f)
{
SuspensionRelativeVelocity = 0;
ClippedInvContactDotSuspension = 1.0f / 0.1f;
}
else
{
float inv = -1.0f / project;
SuspensionRelativeVelocity = projVel * inv;
ClippedInvContactDotSuspension = inv;
}
}
else // Not in contact : position wheel in a nice (rest length) position
{
RaycastInfo.SuspensionLength = SuspensionRestLength;
SuspensionRelativeVelocity = 0;
RaycastInfo.ContactNormalWS = -raycastInfo.WheelDirectionWS;
ClippedInvContactDotSuspension = 1.0f;
}
}
开发者ID:sinkingsugar,项目名称:BulletSharpPInvoke,代码行数:31,代码来源:WheelInfo.cs
示例9: UniversalConstraint
public UniversalConstraint(RigidBody rigidBodyA, RigidBody rigidBodyB, Vector3 anchor,
Vector3 axis1, Vector3 axis2)
: base(btUniversalConstraint_new(rigidBodyA._native, rigidBodyB._native,
ref anchor, ref axis1, ref axis2))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = rigidBodyB;
}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:8,代码来源:UniversalConstraint.cs
示例10: Generic6DofSpringConstraint
public Generic6DofSpringConstraint(RigidBody rigidBodyA, RigidBody rigidBodyB,
Matrix frameInA, Matrix frameInB, bool useLinearReferenceFrameA)
: base(btGeneric6DofSpringConstraint_new(rigidBodyA._native, rigidBodyB._native,
ref frameInA, ref frameInB, useLinearReferenceFrameA))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = rigidBodyB;
}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:8,代码来源:Generic6DofSpringConstraint.cs
示例11: Point2PointConstraint
public Point2PointConstraint(RigidBody rigidBodyA, RigidBody rigidBodyB,
Vector3 pivotInA, Vector3 pivotInB)
: base(btPoint2PointConstraint_new(rigidBodyA._native, rigidBodyB._native,
ref pivotInA, ref pivotInB))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = rigidBodyB;
}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:8,代码来源:Point2PointConstraint.cs
示例12: FixedConstraint
public FixedConstraint(RigidBody rigidBodyA, RigidBody rigidBodyB, Matrix frameInA,
Matrix frameInB)
: base(btFixedConstraint_new(rigidBodyA._native, rigidBodyB._native,
ref frameInA, ref frameInB))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = rigidBodyB;
}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:8,代码来源:FixedConstraint.cs
示例13: GearConstraint
public GearConstraint(RigidBody rigidBodyA, RigidBody rigidBodyB, Vector3 axisInA,
Vector3 axisInB)
: base(btGearConstraint_new(rigidBodyA._native, rigidBodyB._native, ref axisInA,
ref axisInB))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = rigidBodyB;
}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:8,代码来源:GearConstraint.cs
示例14: Apply
protected override void Apply(RigidBody obj, int slice)
{
Vector3D pos = this.FPosition[slice];
Vector3D force = this.FImpulse[slice];
obj.ApplyImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z),
new Vector3((float)pos.x, (float)pos.y, (float)pos.z));
}
开发者ID:sunep,项目名称:dx11-vvvv,代码行数:8,代码来源:BulletApplyImpulseNode.cs
示例15: ConeTwistConstraint
public ConeTwistConstraint(RigidBody rigidBodyA, RigidBody rigidBodyB, Matrix rigidBodyAFrame,
Matrix rigidBodyBFrame)
: base(btConeTwistConstraint_new(rigidBodyA._native, rigidBodyB._native,
ref rigidBodyAFrame, ref rigidBodyBFrame))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = rigidBodyB;
}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:8,代码来源:ConeTwistConstraint.cs
示例16: SetUpBulletPhysicsBody
public void SetUpBulletPhysicsBody(float mass, BulletSharp.MotionState motionState, BulletSharp.CollisionShape collisionShape, Vector3 localInertia)
{
BulletSharpPhysics.RigidBodyConstructionInfo rbInfo =
new BulletSharpPhysics.RigidBodyConstructionInfo(mass, motionState, collisionShape, localInertia);
RigidBody = new BulletSharpPhysics.RigidBody(rbInfo);
bulletPhysics.World.AddRigidBody(RigidBody,GetCollisionFlags(),GetCollisionMask());
}
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:9,代码来源:BulletSharpObject.cs
示例17: GetConstraint
//public void Test()
//{
// BulletSharp.Point2PointConstraint pt;
// /BulletSharp.Generic6DofConstraint sdof = new Generic6DofConstraint(
// pt.Setting.
//sdof.sett
//}
public override TypedConstraint GetConstraint(RigidBody body)
{
Point2PointConstraint cst = new Point2PointConstraint(body, this.Pivot);
cst.Setting.Damping = this.Damping;
cst.Setting.ImpulseClamp = this.ImpulseClamp;
cst.Setting.Tau = this.Tau;
return cst;
}
开发者ID:sunep,项目名称:dx11-vvvv,代码行数:16,代码来源:P2PSingleConstraintDefinition.cs
示例18: doSomething
/// <summary>
/// output some text, show/hide a dialogue, and change the color of the region
/// </summary>
void doSomething(TriggerRegion region, RigidBody otherBody, TriggerReportFlags flags, CollisionReportInfo info)
{
if (flags.HasFlag(TriggerReportFlags.Enter)) {
Console.WriteLine(otherBody.GetName() + " has entered trigger area \"" + region.Name + "\"");
// cycle through the balloon colors
region.CycleToNextColor();
}
else {
Console.WriteLine(otherBody.GetName() + " has left trigger area \"" + region.Name + "\"");
region.CycleToNextColor();
}
}
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:15,代码来源:TriggerRegionsTest.cs
示例19: Prop
public Prop(CollisionShape shape, float mass, Matrix4 start)
{
Physics physics = Game.Instance.Physics;
Shape = shape;
IsDynamic = (mass != 0.0f);
physics.Props.Add(this);
Vector3 inertia = Vector3.Zero;
if (IsDynamic) shape.CalculateLocalInertia(mass, out inertia);
DefaultMotionState motionState = new DefaultMotionState(start);
RigidBody.RigidBodyConstructionInfo info = new RigidBody.RigidBodyConstructionInfo(mass, motionState, shape, inertia);
Body = new RigidBody(info);
physics.World.AddRigidBody(Body);
}
开发者ID:copygirl,项目名称:Blocky,代码行数:14,代码来源:Prop.cs
示例20: TestContactTest
void TestContactTest(RigidBody testBody, RigidBody testBody2)
{
object context = "your context";
ContactSensorCallback contactCallback = new ContactSensorCallback(testBody, context);
world.ContactTest(testBody, contactCallback);
testBody.CollisionFlags |= CollisionFlags.CustomMaterialCallback;
testBody2.CollisionFlags |= CollisionFlags.CustomMaterialCallback;
world.ContactPairTest(testBody, testBody2, contactCallback);
testBody.CollisionFlags &= ~CollisionFlags.CustomMaterialCallback;
testBody2.CollisionFlags &= ~CollisionFlags.CustomMaterialCallback;
AddToDisposeQueue(contactCallback);
}
开发者ID:rhynodegreat,项目名称:BulletSharp,代码行数:14,代码来源:BulletTests.cs
注:本文中的BulletSharp.RigidBody类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论