Groundcheck ist jetzt eine sphere
This commit is contained in:
parent
6f29dd08ba
commit
1411eb68c9
@ -238,7 +238,7 @@ CapsuleCollider:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_IsTrigger: 1
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
|
@ -241,7 +241,7 @@ GameObject:
|
||||
- component: {fileID: 85981682}
|
||||
- component: {fileID: 85981681}
|
||||
- component: {fileID: 85981680}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (10)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -346,7 +346,7 @@ GameObject:
|
||||
- component: {fileID: 114364427}
|
||||
- component: {fileID: 114364426}
|
||||
- component: {fileID: 114364425}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (8)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -754,7 +754,7 @@ GameObject:
|
||||
- component: {fileID: 501623796}
|
||||
- component: {fileID: 501623795}
|
||||
- component: {fileID: 501623794}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (2)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -859,7 +859,7 @@ GameObject:
|
||||
- component: {fileID: 910873179}
|
||||
- component: {fileID: 910873178}
|
||||
- component: {fileID: 910873177}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -964,7 +964,7 @@ GameObject:
|
||||
- component: {fileID: 932180918}
|
||||
- component: {fileID: 932180917}
|
||||
- component: {fileID: 932180916}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (3)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -1069,7 +1069,7 @@ GameObject:
|
||||
- component: {fileID: 1076738178}
|
||||
- component: {fileID: 1076738177}
|
||||
- component: {fileID: 1076738176}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (6)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -1266,7 +1266,7 @@ GameObject:
|
||||
- component: {fileID: 1203847030}
|
||||
- component: {fileID: 1203847029}
|
||||
- component: {fileID: 1203847028}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (5)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -1371,7 +1371,7 @@ GameObject:
|
||||
- component: {fileID: 1319344285}
|
||||
- component: {fileID: 1319344284}
|
||||
- component: {fileID: 1319344283}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (9)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -1476,7 +1476,7 @@ GameObject:
|
||||
- component: {fileID: 1440656380}
|
||||
- component: {fileID: 1440656379}
|
||||
- component: {fileID: 1440656378}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (4)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -1729,7 +1729,7 @@ GameObject:
|
||||
- component: {fileID: 1869426202}
|
||||
- component: {fileID: 1869426201}
|
||||
- component: {fileID: 1869426200}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (7)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -1834,7 +1834,7 @@ GameObject:
|
||||
- component: {fileID: 2037506472}
|
||||
- component: {fileID: 2037506471}
|
||||
- component: {fileID: 2037506470}
|
||||
m_Layer: 0
|
||||
m_Layer: 6
|
||||
m_Name: Cube (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -2085,6 +2085,14 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8630772403149418534, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3}
|
||||
propertyPath: jumpPointRadius
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8630772403149418534, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3}
|
||||
propertyPath: jumpPointDistance
|
||||
value: 0.55
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
|
@ -10,7 +10,9 @@ public class PlayerMoveScript : MonoBehaviour
|
||||
[Header("Movement")]
|
||||
[SerializeField] private float speed;
|
||||
[SerializeField] private float jumpForce;
|
||||
[SerializeField] private float checkForJump;
|
||||
[SerializeField] private float jumpPointDistance;
|
||||
[SerializeField] private float jumpPointRadius;
|
||||
|
||||
[Header("Looking")]
|
||||
[SerializeField] private float xSensitivity;
|
||||
[SerializeField] private float ySensitivity;
|
||||
@ -18,6 +20,7 @@ public class PlayerMoveScript : MonoBehaviour
|
||||
private Rigidbody rb;
|
||||
|
||||
private bool cursorIsLocked;
|
||||
private LayerMask ground;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@ -25,15 +28,7 @@ public class PlayerMoveScript : MonoBehaviour
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
cursorIsLocked = true;
|
||||
|
||||
float degree = 100.0f; // Beispielwert, der außerhalb des Bereichs liegt
|
||||
|
||||
degree = Mathf.Clamp(degree, -90, 90);
|
||||
Debug.Log(degree); // Ausgabe: 90
|
||||
|
||||
degree = -100.0f; // Beispielwert, der außerhalb des Bereichs liegt
|
||||
|
||||
degree = Mathf.Clamp(degree, -90, 90);
|
||||
Debug.Log(degree); // Ausgabe: -90
|
||||
ground = LayerMask.GetMask("Ground");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@ -67,7 +62,7 @@ public class PlayerMoveScript : MonoBehaviour
|
||||
{
|
||||
if(Input.GetKey(KeyCode.Space))
|
||||
{
|
||||
if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.down), checkForJump))
|
||||
if (Physics.CheckSphere(transform.position + Vector3.down * jumpPointDistance, jumpPointRadius, ground) )
|
||||
{
|
||||
rb.isKinematic = true;
|
||||
rb.isKinematic = false;
|
||||
@ -81,8 +76,14 @@ public class PlayerMoveScript : MonoBehaviour
|
||||
{
|
||||
// Draws a Line for checkForJump
|
||||
Gizmos.color = Color.red;
|
||||
Vector3 direction = transform.TransformDirection(Vector3.down) * checkForJump;
|
||||
Vector3 direction = transform.TransformDirection(Vector3.down) * jumpPointDistance;
|
||||
Gizmos.DrawRay(transform.position, direction);
|
||||
|
||||
// Draw a yellow sphere at the transform's position
|
||||
Gizmos.color = Color.blue;
|
||||
Gizmos.DrawWireSphere(transform.position + Vector3.down * jumpPointDistance, jumpPointRadius);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public float newDirY;
|
||||
|
Loading…
Reference in New Issue
Block a user