Skip to content

Commit

Permalink
Atom Collision - toggle switches collision layers
Browse files Browse the repository at this point in the history
use 'Water' layer for non colliding atoms
  • Loading branch information
ddoak committed May 8, 2019
1 parent e392960 commit 5cf4a93
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
30 changes: 29 additions & 1 deletion Assets/PolyPep/Scripts/PolyPepBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,42 @@ public void SetAllColliderIsTrigger(bool value)
// }
//}

//if (value == true)
//{
// Physics.IgnoreLayerCollision(LayerMask.NameToLayer("Atom"), LayerMask.NameToLayer("Atom"), true);
//}
//else
//{
// Physics.IgnoreLayerCollision(LayerMask.NameToLayer("Atom"), LayerMask.NameToLayer("Atom"), false);
//}


Collider[] allChildren = GetComponentsInChildren<Collider>();
foreach (Collider childCollider in allChildren)
{
childCollider.isTrigger = value;
//childCollider.isTrigger = value;

//sidechain colliders need to be explicitly set - bug
childCollider.isTrigger = false;

if (childCollider.gameObject.layer != LayerMask.NameToLayer("Hbond"))
{
if (value == true)
{
childCollider.gameObject.layer = LayerMask.NameToLayer("Water");
}
else
{
childCollider.gameObject.layer = LayerMask.NameToLayer("Atom");

}
}

if (childCollider.name.Contains("bond"))
{
// Debug.Log(childCollider.name);
// deletes ALL bond colliders!
// attempt at culling unused components
Destroy(childCollider);
}

Expand Down
4 changes: 2 additions & 2 deletions Assets/Scenes/Scene_Peppy.unity
Original file line number Diff line number Diff line change
Expand Up @@ -51023,7 +51023,7 @@ MonoBehaviour:
bButton: 2
excludeLayers:
serializedVersion: 2
m_Bits: 823
m_Bits: 807
raycastDistance: 500
myRawInteraction: {fileID: 1919213148}
myOVRPointerVisualizer: {fileID: 1082519095}
Expand Down Expand Up @@ -54980,7 +54980,7 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_text: ' "Peppy" v0.57 (07-05-2019)'
m_text: ' "Peppy" v0.58 (08-05-2019)'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
Expand Down
8 changes: 6 additions & 2 deletions ProjectSettings/DynamicsManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 7
serializedVersion: 10
m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
Expand All @@ -17,13 +17,17 @@ PhysicsManager:
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: fffdfffffffdfffffffdfffffffffffffffdfffffffdfffffffffffffffffffffffdffffc8fcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: effdffffeffdffffeffdffffffffffffc8c0ffffeffdffffffffffffffffffffeffdffffc8fcffffefdfffffefffffffefffffffefdbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 1
m_ReuseCollisionCallbacks: 0
m_ClothInterCollisionSettingsToggle: 0
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 250, y: 250, z: 250}
m_WorldSubdivisions: 8
m_FrictionType: 0
m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PlayerSettings:
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: DefaultCompany
productName: peppy_v0.57
productName: peppy_v0.58
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
Expand Down Expand Up @@ -118,7 +118,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.57
bundleVersion: 0.58
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down

0 comments on commit 5cf4a93

Please sign in to comment.