Fix collisions further

This commit is contained in:
Jens Pitkänen 2020-04-19 17:42:42 +03:00
parent 05329adce6
commit 11216b18e2
6 changed files with 91 additions and 10 deletions

View File

@ -12,7 +12,7 @@ GameObject:
- component: {fileID: 1683130550026608685} - component: {fileID: 1683130550026608685}
- component: {fileID: 986826787110512831} - component: {fileID: 986826787110512831}
- component: {fileID: 7293540718676611162} - component: {fileID: 7293540718676611162}
m_Layer: 0 m_Layer: 9
m_Name: Campfire m_Name: Campfire
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -35,6 +35,7 @@ Transform:
- {fileID: 8703236790229133739} - {fileID: 8703236790229133739}
- {fileID: 8279143985661205166} - {fileID: 8279143985661205166}
- {fileID: 664587661892241191} - {fileID: 664587661892241191}
- {fileID: 4407621139176341806}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -101,7 +102,8 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 664587661892241191} - component: {fileID: 664587661892241191}
- component: {fileID: 3313787702854768125} - component: {fileID: 3313787702854768125}
m_Layer: 0 - component: {fileID: 6502800549939180594}
m_Layer: 9
m_Name: Collider m_Name: Collider
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -133,7 +135,20 @@ BoxCollider:
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 0.2, z: 1} m_Size: {x: 0.6, y: 0.2, z: 1}
m_Center: {x: 0, y: 0.041, z: 0}
--- !u!65 &6502800549939180594
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4030757379513544979}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 0.2, z: 0.6}
m_Center: {x: 0, y: 0.041, z: 0} m_Center: {x: 0, y: 0.041, z: 0}
--- !u!1 &4797807552203538256 --- !u!1 &4797807552203538256
GameObject: GameObject:
@ -145,7 +160,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 8703236790229133739} - component: {fileID: 8703236790229133739}
- component: {fileID: 6245881137502637047} - component: {fileID: 6245881137502637047}
m_Layer: 0 m_Layer: 9
m_Name: Campfire Light m_Name: Campfire Light
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -238,7 +253,7 @@ GameObject:
- component: {fileID: 5299650773545078260} - component: {fileID: 5299650773545078260}
- component: {fileID: 2943469733383700679} - component: {fileID: 2943469733383700679}
- component: {fileID: 3600058222818994886} - component: {fileID: 3600058222818994886}
m_Layer: 0 m_Layer: 9
m_Name: Particle System m_Name: Particle System
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -4990,6 +5005,51 @@ ParticleSystemRenderer:
m_Mesh2: {fileID: 0} m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0} m_Mesh3: {fileID: 0}
m_MaskInteraction: 0 m_MaskInteraction: 0
--- !u!1 &7439796550306582221
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4407621139176341806}
- component: {fileID: 7258398958978246311}
m_Layer: 12
m_Name: Wall for Player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4407621139176341806
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7439796550306582221}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8265150240760341263}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &7258398958978246311
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7439796550306582221}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.7
m_Height: 10
m_Direction: 1
m_Center: {x: 0, y: 4.3, z: 0}
--- !u!1 &8502149746935864804 --- !u!1 &8502149746935864804
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5000,7 +5060,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 8279143985661205166} - component: {fileID: 8279143985661205166}
- component: {fileID: 964052589141395917} - component: {fileID: 964052589141395917}
m_Layer: 0 m_Layer: 9
m_Name: Burning Effect Audio Source m_Name: Burning Effect Audio Source
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -5190,11 +5250,26 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: campfire value: campfire
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -927199367670048503, guid: 4facd75878c39c7499d4291e717cda98,
type: 3}
propertyPath: m_Layer
value: 9
objectReference: {fileID: 0}
- target: {fileID: 4492701032547155838, guid: 4facd75878c39c7499d4291e717cda98, - target: {fileID: 4492701032547155838, guid: 4facd75878c39c7499d4291e717cda98,
type: 3} type: 3}
propertyPath: m_Materials.Array.data[0] propertyPath: m_Materials.Array.data[0]
value: value:
objectReference: {fileID: 2100000, guid: dd1e210d1875fe3418bb5765f613411d, type: 2} objectReference: {fileID: 2100000, guid: dd1e210d1875fe3418bb5765f613411d, type: 2}
- target: {fileID: 4709435797784724906, guid: 4facd75878c39c7499d4291e717cda98,
type: 3}
propertyPath: m_Layer
value: 9
objectReference: {fileID: 0}
- target: {fileID: 7414567728959065772, guid: 4facd75878c39c7499d4291e717cda98,
type: 3}
propertyPath: m_Layer
value: 9
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4facd75878c39c7499d4291e717cda98, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 4facd75878c39c7499d4291e717cda98, type: 3}
--- !u!4 &3464217916028558321 stripped --- !u!4 &3464217916028558321 stripped

View File

@ -3648,5 +3648,10 @@ PrefabInstance:
propertyPath: GrabText propertyPath: GrabText
value: value:
objectReference: {fileID: 1849724586} objectReference: {fileID: 1849724586}
- target: {fileID: 7093134810128755097, guid: 558201eae20fa5540a826edb23937665,
type: 3}
propertyPath: DroppingRaycastMask.m_Bits
value: 3895
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 558201eae20fa5540a826edb23937665, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 558201eae20fa5540a826edb23937665, type: 3}

View File

@ -73,7 +73,7 @@ public class Campfire : MonoBehaviour {
private void OnCollisionEnter(Collision c) { private void OnCollisionEnter(Collision c) {
if (c.collider.attachedRigidbody != null && c.collider.attachedRigidbody) { if (c.collider.attachedRigidbody != null && c.collider.attachedRigidbody) {
Burnable Burnable = c.collider.attachedRigidbody.GetComponent<Burnable>(); Burnable Burnable = c.collider.attachedRigidbody.GetComponent<Burnable>();
if (Burnable != null) { if (Burnable != null && !LogQueue.Contains(Burnable)) {
LogQueue.Add(Burnable); LogQueue.Add(Burnable);
} }
} }

View File

@ -9,6 +9,7 @@ public class ItemGrabber : MonoBehaviour {
public CanvasGroup GrabHint; public CanvasGroup GrabHint;
public Text GrabText; public Text GrabText;
public LayerMask ItemLayer; public LayerMask ItemLayer;
public LayerMask DroppingRaycastMask;
public float Distance; public float Distance;
public float ThrowVelocity; public float ThrowVelocity;
@ -42,7 +43,7 @@ public class ItemGrabber : MonoBehaviour {
} }
} else if (Input.GetButtonDown("Grab")) { } else if (Input.GetButtonDown("Grab")) {
Vector3 DropPosition; Vector3 DropPosition;
if (Physics.Raycast(From, Direction, out Hit, Distance * 2f)) { if (Physics.Raycast(From, Direction, out Hit, Distance * 2f, DroppingRaycastMask)) {
DropPosition = Hit.point + Hit.normal * 0.1f; DropPosition = Hit.point + Hit.normal * 0.1f;
} else { } else {
DropPosition = From + Direction * Distance; DropPosition = From + Direction * Distance;

View File

@ -17,7 +17,7 @@ PhysicsManager:
m_ClothInterCollisionDistance: 0 m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0 m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1 m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffefffffffefffffffefffffffffffffffefffffffefffffffffffffffffffffffefffffffefffffffe7fffffffbffffc8e8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff m_LayerCollisionMatrix: ffefffffffefffffffefffffffffffffffefffffffefffffffffffffffffffffffefffffffefffffffe7fffffffbffffc8f8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1 m_AutoSimulation: 1
m_AutoSyncTransforms: 0 m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1 m_ReuseCollisionCallbacks: 1

View File

@ -19,7 +19,7 @@ TagManager:
- Campfire - Campfire
- Item - Item
- Player - Player
- - Walls for Players
- -
- -
- -