Skip to content

Commit 0a1bf3b

Browse files
committed
Added a ragdoll demo
tweeked the debug flags Added a 'lame' capsule procedural primitive.
1 parent e8323d7 commit 0a1bf3b

17 files changed

Lines changed: 360 additions & 23 deletions

File tree

UnityProject/Assets/BulletUnity/Examples/Scenes/BulletSharpDemos/BulletSharpDemos/ConvexDecompositionDemo/data.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/BulletUnity/Examples/Scenes/Ragdoll.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

UnityProject/Assets/BulletUnity/Examples/Scenes/Ragdoll/Ragdoll.unity.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/BulletUnity/Scripts/BPhysicsWorld.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public bool AddCollisionObject(BCollisionObject co)
340340
{
341341
if (!_isDisposed)
342342
{
343-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Adding collision object {0} to world", co);
343+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Adding collision object {0} to world", co);
344344
if (co._BuildCollisionObject())
345345
{
346346
m_world.AddCollisionObject(co.GetCollisionObject(), co.m_groupsIBelongTo, co.m_collisionMask);
@@ -364,7 +364,7 @@ public void RemoveCollisionObject(BulletSharp.CollisionObject co)
364364
{
365365
if (!_isDisposed)
366366
{
367-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Removing collisionObject {0} from world", co.UserObject);
367+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Removing collisionObject {0} from world", co.UserObject);
368368
m_world.RemoveCollisionObject(co);
369369
if (co.UserObject is BCollisionObject) ((BCollisionObject)co.UserObject).isInWorld = false;
370370
//TODO handle removing kinematic character controller action
@@ -379,7 +379,7 @@ public bool AddRigidBody(BRigidBody rb)
379379
{
380380
BDebug.LogError(debugType, "World type must not be collision only");
381381
}
382-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Adding rigidbody {0} to world", rb);
382+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Adding rigidbody {0} to world", rb);
383383
if (rb._BuildCollisionObject())
384384
{
385385
((DiscreteDynamicsWorld)m_world).AddRigidBody((RigidBody)rb.GetCollisionObject(), rb.m_groupsIBelongTo, rb.m_collisionMask);
@@ -398,7 +398,7 @@ public void RemoveRigidBody(BulletSharp.RigidBody rb)
398398
{
399399
BDebug.LogError(debugType, "World type must not be collision only");
400400
}
401-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Removing rigidbody {0} from world", rb.UserObject);
401+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Removing rigidbody {0} from world", rb.UserObject);
402402
((DiscreteDynamicsWorld)m_world).RemoveRigidBody(rb);
403403
if (rb.UserObject is BCollisionObject) ((BCollisionObject)rb.UserObject).isInWorld = false;
404404
}
@@ -413,7 +413,7 @@ public bool AddConstraint(BTypedConstraint c)
413413
BDebug.LogError(debugType, "World type must not be collision only");
414414
return false;
415415
}
416-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Adding constraint {0} to world", c);
416+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Adding constraint {0} to world", c);
417417
if (c._BuildConstraint())
418418
{
419419
((DiscreteDynamicsWorld)m_world).AddConstraint(c.GetConstraint(), c.m_disableCollisionsBetweenConstrainedBodies);
@@ -432,7 +432,7 @@ public void RemoveConstraint(BulletSharp.TypedConstraint c)
432432
{
433433
BDebug.LogError(debugType, "World type must not be collision only");
434434
}
435-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Removing constraint {0} from world", c.Userobject);
435+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Removing constraint {0} from world", c.Userobject);
436436
((DiscreteDynamicsWorld)m_world).RemoveConstraint(c);
437437
if (c.Userobject is BTypedConstraint) ((BTypedConstraint)c.Userobject).m_isInWorld = false;
438438
}
@@ -442,12 +442,12 @@ public bool AddSoftBody(BSoftBody softBody)
442442
{
443443
if (!(m_world is BulletSharp.SoftBody.SoftRigidDynamicsWorld))
444444
{
445-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("The Physics World must be a BSoftBodyWorld for adding soft bodies");
445+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("The Physics World must be a BSoftBodyWorld for adding soft bodies");
446446
return false;
447447
}
448448
if (!_isDisposed)
449449
{
450-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Adding softbody {0} to world", softBody);
450+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Adding softbody {0} to world", softBody);
451451
if (softBody._BuildCollisionObject())
452452
{
453453
((BulletSharp.SoftBody.SoftRigidDynamicsWorld)m_world).AddSoftBody((SoftBody)softBody.GetCollisionObject());
@@ -462,7 +462,7 @@ public void RemoveSoftBody(BulletSharp.SoftBody.SoftBody softBody)
462462
{
463463
if (!_isDisposed && m_world is BulletSharp.SoftBody.SoftRigidDynamicsWorld)
464464
{
465-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Removing softbody {0} from world", softBody.UserObject);
465+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Removing softbody {0} from world", softBody.UserObject);
466466
((BulletSharp.SoftBody.SoftRigidDynamicsWorld)m_world).RemoveSoftBody(softBody);
467467
if (softBody.UserObject is BCollisionObject) ((BCollisionObject)softBody.UserObject).isInWorld = false;
468468
}
@@ -554,25 +554,25 @@ protected virtual void _InitializePhysicsWorld() {
554554
}
555555

556556
protected void Dispose(bool disposing) {
557-
if (debugType <= BDebug.DebugType.Debug) Debug.Log("BDynamicsWorld Disposing physics.");
557+
if (debugType >= BDebug.DebugType.Debug) Debug.Log("BDynamicsWorld Disposing physics.");
558558

559559
if (m_world != null) {
560560
//remove/dispose constraints
561561
int i;
562562
if (_ddWorld != null)
563563
{
564-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Removing Constraints {0}", _ddWorld.NumConstraints);
564+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Removing Constraints {0}", _ddWorld.NumConstraints);
565565
for (i = _ddWorld.NumConstraints - 1; i >= 0; i--)
566566
{
567567
TypedConstraint constraint = _ddWorld.GetConstraint(i);
568568
_ddWorld.RemoveConstraint(constraint);
569569
if (constraint.Userobject is BTypedConstraint) ((BTypedConstraint)constraint.Userobject).m_isInWorld = false;
570-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Removed Constaint {0}", constraint.Userobject);
570+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Removed Constaint {0}", constraint.Userobject);
571571
constraint.Dispose();
572572
}
573573
}
574574

575-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Removing Collision Objects {0}", _ddWorld.NumCollisionObjects);
575+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Removing Collision Objects {0}", _ddWorld.NumCollisionObjects);
576576
//remove the rigidbodies from the dynamics world and delete them
577577
for (i = m_world.NumCollisionObjects - 1; i >= 0; i--) {
578578
CollisionObject obj = m_world.CollisionObjectArray[i];
@@ -583,7 +583,7 @@ protected void Dispose(bool disposing) {
583583
}
584584
m_world.RemoveCollisionObject(obj);
585585
if (obj.UserObject is BCollisionObject) ((BCollisionObject)obj.UserObject).isInWorld = false;
586-
if (debugType <= BDebug.DebugType.Debug) Debug.LogFormat("Removed CollisionObject {0}", obj.UserObject);
586+
if (debugType >= BDebug.DebugType.Debug) Debug.LogFormat("Removed CollisionObject {0}", obj.UserObject);
587587
obj.Dispose();
588588
}
589589

UnityProject/Assets/BulletUnity/Scripts/CollisionShapes/BBoxShape.cs.meta

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/BulletUnity/Scripts/CollisionShapes/BCapsuleShape.cs.meta

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/BulletUnity/Scripts/CollisionShapes/BConeShape.cs.meta

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/BulletUnity/Scripts/CollisionShapes/BSphereShape.cs.meta

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
using BulletUnity;
4+
5+
[CustomEditor(typeof(BConeTwistConstraint))]
6+
public class BConeTwistConstraintEditor : Editor {
7+
8+
9+
10+
public override void OnInspectorGUI() {
11+
EditorGUILayout.HelpBox(BConeTwistConstraint.HelpMessage, MessageType.Info);
12+
DrawDefaultInspector();
13+
}
14+
}

0 commit comments

Comments
 (0)