broken player rotation

This commit is contained in:
nexovec 2022-01-28 23:18:07 +01:00
parent 3a3cd1fc0d
commit 544868c386
2 changed files with 9 additions and 7 deletions

View File

@ -363,7 +363,7 @@ GameObject:
- component: {fileID: 708734973} - component: {fileID: 708734973}
m_Layer: 0 m_Layer: 0
m_Name: Cube m_Name: Cube
m_TagString: Untagged m_TagString: platform
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -460,7 +460,7 @@ GameObject:
- component: {fileID: 875163559} - component: {fileID: 875163559}
m_Layer: 0 m_Layer: 0
m_Name: Cube (4) m_Name: Cube (4)
m_TagString: Untagged m_TagString: platform
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -558,7 +558,7 @@ GameObject:
- component: {fileID: 1429068750} - component: {fileID: 1429068750}
m_Layer: 0 m_Layer: 0
m_Name: Cube (1) m_Name: Cube (1)
m_TagString: Untagged m_TagString: platform
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -720,7 +720,7 @@ GameObject:
- component: {fileID: 2031243810} - component: {fileID: 2031243810}
m_Layer: 0 m_Layer: 0
m_Name: Cube (3) m_Name: Cube (3)
m_TagString: Untagged m_TagString: platform
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0

View File

@ -62,11 +62,13 @@ public class PlayerController : MonoBehaviour
{ {
if (collision.gameObject.tag == "platform") if (collision.gameObject.tag == "platform")
{ {
this.gameObject.transform.rotation = collision.gameObject.transform.rotation; -- FIXME:
var thisTransform = this.gameObject.transform;
thisTransform.eulerAngles = new Vector3(thisTransform.eulerAngles.x, thisTransform.eulerAngles.y, collision.transform.eulerAngles.z);
Vector3 direction = collision.gameObject.transform.rotation * Vector3.down; Vector3 gDirection = new Quaternion(0.0f, 0.0f, collision.gameObject.transform.rotation.z, 1.0f) * Vector3.down;
Physics.gravity = direction * 9.81f; Physics.gravity = gDirection * 9.81f;
Debug.Log(Physics.gravity); Debug.Log(Physics.gravity);
//Physics.gravity = -Physics.gravity; //Physics.gravity = -Physics.gravity;
} }