Skip to content
Snippets Groups Projects
Commit ad13abeb authored by MuhamadAjiW's avatar MuhamadAjiW
Browse files

fix: ground detection

parent dafb83e3
1 merge request!9Feat/player
......@@ -29,7 +29,7 @@ Transform:
m_GameObject: {fileID: 6146631199650576833}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0.3}
m_LocalScale: {x: 0.1, y: 0.1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
......@@ -121,4 +121,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: dc4d5359067cdfb47a45684d6cc1482a, type: 3}
m_Name:
m_EditorClassIdentifier:
WeaponPivot: {x: 0, y: 0, z: 0}
staticWeaponPivot: {x: 0, y: 0, z: 0}
dynamicBottomPoint: {fileID: 0}
dynamicWeaponPivot: {fileID: 0}
......@@ -16,7 +16,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &1050311400148833009
Transform:
m_ObjectHideFlags: 0
......@@ -26,7 +26,7 @@ Transform:
m_GameObject: {fileID: 5240801910879785525}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.258, y: 0.889, z: 0.375}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
......@@ -57,34 +57,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1050311400148833009}
m_Modifications:
- target: {fileID: 691014024523472006, guid: 50599534a77c7dd46b591a71fbb5feba, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 691014024523472006, guid: 50599534a77c7dd46b591a71fbb5feba, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 691014024523472006, guid: 50599534a77c7dd46b591a71fbb5feba, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 691014024523472006, guid: 50599534a77c7dd46b591a71fbb5feba, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 691014024523472006, guid: 50599534a77c7dd46b591a71fbb5feba, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 691014024523472006, guid: 50599534a77c7dd46b591a71fbb5feba, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 691014024523472006, guid: 50599534a77c7dd46b591a71fbb5feba, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 691014024523472006, guid: 50599534a77c7dd46b591a71fbb5feba, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
......
......@@ -301,7 +301,7 @@ Transform:
m_GameObject: {fileID: 464623400}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.08, y: 1, z: 3.57}
m_LocalPosition: {x: 2.08, y: 2, z: 3.57}
m_LocalScale: {x: 1, y: 4, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
......@@ -711,7 +711,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5801067718172810331, guid: c21e0108f08f0d74b92e3576ec7a7ecc, type: 3}
propertyPath: m_LocalPosition.y
value: 0.15
value: 1.03
objectReference: {fileID: 0}
- target: {fileID: 5801067718172810331, guid: c21e0108f08f0d74b92e3576ec7a7ecc, type: 3}
propertyPath: m_LocalPosition.z
......@@ -813,7 +813,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 6141342063799955615, guid: 7e312250336c0244193b4b75151d4fe3, type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6141342063799955615, guid: 7e312250336c0244193b4b75151d4fe3, type: 3}
propertyPath: m_LocalPosition.z
......@@ -851,6 +851,10 @@ PrefabInstance:
propertyPath: m_Name
value: Dummy
objectReference: {fileID: 0}
- target: {fileID: 8491347043216026353, guid: 7e312250336c0244193b4b75151d4fe3, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
......@@ -874,7 +878,7 @@ PrefabInstance:
objectReference: {fileID: 13400000, guid: 6b36fb2e3a8a80643988a623d515cbcc, type: 2}
- target: {fileID: 5263704032773805873, guid: c98b222ded23bb24690e674886e5741a, type: 3}
propertyPath: m_LocalPosition.y
value: -0.17
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6541102688641435260, guid: c98b222ded23bb24690e674886e5741a, type: 3}
propertyPath: m_Name
......@@ -886,7 +890,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7065619579114910469, guid: c98b222ded23bb24690e674886e5741a, type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7065619579114910469, guid: c98b222ded23bb24690e674886e5741a, type: 3}
propertyPath: m_LocalPosition.z
......@@ -1049,7 +1053,7 @@ Transform:
m_GameObject: {fileID: 1819086314}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -0.875, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 100, y: 0.25, z: 100}
m_ConstrainProportionsScale: 0
m_Children:
......@@ -16035,7 +16039,7 @@ Transform:
m_GameObject: {fileID: 6980932137625789381}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 1.117, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
......@@ -16637,6 +16641,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
staticWeaponPivot: {x: 0, y: 0, z: 0}
dynamicBottomPoint: {fileID: 4405864418124909757}
dynamicWeaponPivot: {fileID: 3706625295582542003}
--- !u!1 &7805749297904559699
GameObject:
......
......@@ -50,7 +50,7 @@ public class WorldEntity : WorldObject, IRigid
}
#endif
groundDetectionSize = new Vector3(0.05f, 0.02f, 0.05f);
groundDetectionSize = new Vector3(0.05f, 0.05f, 0.05f);
groundLayers = LayerMask.GetMask(EnvironmentConfig.LAYER_DEFAULT);
model.gameObject.layer = LayerMask.NameToLayer(LayerCode);
}
......
......@@ -5,20 +5,19 @@ public class Model : MonoBehaviour
{
// Attributes
public Vector3 staticWeaponPivot;
public Transform dynamicBottomPoint;
public Transform dynamicWeaponPivot;
[NonSerialized] public new Renderer renderer;
[NonSerialized] public float bottomOffset;
// Set-getters
public Vector3 WeaponPivot => dynamicWeaponPivot == null ? staticWeaponPivot : dynamicWeaponPivot.position;
public Vector3 Bottom => new(transform.position.x, transform.position.y - bottomOffset, transform.position.z);
public Vector3 Bottom => dynamicBottomPoint == null? new(transform.position.x, transform.position.y - bottomOffset, transform.position.z) : dynamicBottomPoint.position;
// Constructors
protected void Start(){
renderer = GetComponent<Renderer>();
Debug.Log(renderer);
#if STRICT
if (renderer == null)
{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment