Some edits in playert
This commit is contained in:
parent
db767d7a9d
commit
cd6745724d
@ -23,6 +23,9 @@ public class PlayerController : MonoBehaviour
|
|||||||
private bool isGrounded = false;
|
private bool isGrounded = false;
|
||||||
public bool isRunning = false;
|
public bool isRunning = false;
|
||||||
|
|
||||||
|
private Vector3 saveRotation;
|
||||||
|
private Vector3 saveStartRotation;
|
||||||
|
|
||||||
private Vector3 downDirection;
|
private Vector3 downDirection;
|
||||||
|
|
||||||
private Vector3 follow = Vector3.zero;
|
private Vector3 follow = Vector3.zero;
|
||||||
@ -112,7 +115,8 @@ public class PlayerController : MonoBehaviour
|
|||||||
// if (platform.type == PlatformManager.PlatformType.SpeedUp)
|
// if (platform.type == PlatformManager.PlatformType.SpeedUp)
|
||||||
// {
|
// {
|
||||||
angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.GetContact(0).normal));
|
angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.GetContact(0).normal));
|
||||||
transform.RotateAround(axis, angle);
|
transform.Rotate(axis * angle * 100.0f * Time.deltaTime);
|
||||||
|
//transform.RotateAround(axis, angle);
|
||||||
// }
|
// }
|
||||||
// TODO: Handle other PlatformTypes
|
// TODO: Handle other PlatformTypes
|
||||||
Physics.gravity = -other.GetContact(0).normal * 9.81f;
|
Physics.gravity = -other.GetContact(0).normal * 9.81f;
|
||||||
@ -124,6 +128,7 @@ public class PlayerController : MonoBehaviour
|
|||||||
isGrounded = true;
|
isGrounded = true;
|
||||||
if (other.gameObject.tag == "platform")
|
if (other.gameObject.tag == "platform")
|
||||||
{
|
{
|
||||||
|
|
||||||
if (other.GetContact(0).normal == other.transform.forward
|
if (other.GetContact(0).normal == other.transform.forward
|
||||||
|| other.GetContact(0).normal == -other.transform.forward
|
|| other.GetContact(0).normal == -other.transform.forward
|
||||||
|| (
|
|| (
|
||||||
@ -143,7 +148,8 @@ public class PlayerController : MonoBehaviour
|
|||||||
if (axis != Vector3.zero)
|
if (axis != Vector3.zero)
|
||||||
{
|
{
|
||||||
angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.GetContact(0).normal));
|
angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.GetContact(0).normal));
|
||||||
transform.RotateAround(axis, angle);
|
transform.Rotate(axis * angle * 100.0f * Time.deltaTime);
|
||||||
|
//transform.RotateAround(axis, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 gDirection;
|
Vector3 gDirection;
|
||||||
|
Loading…
Reference in New Issue
Block a user