Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HedgeCamera code
- public bool is2D;
- public float x2D;
- public float y2D;
- public float z2D;
- public float CameraMaxDistance2D;
- -----------------------------------------------------
- if (is2D == false)
- {
- if (!UseCurve)
- {
- float NormalMod = Mathf.Abs(Player.b_normalSpeed - Player.MaxSpeed);
- x += (((Input.GetAxis("Horizontal")) * NormalMod) * AutoXRotationSpeed) * Time.deltaTime;
- ;
- y -= 0;
- z = 0;
- }
- else
- {
- CurveX = AutoXRotationCurve.Evaluate((Player.rigidbody.velocity.sqrMagnitude / Player.MaxSpeed) / Player.MaxSpeed);
- CurveX = CurveX * 100;
- x += (((Input.GetAxis("Horizontal")) * CurveX) * AutoXRotationSpeed) * Time.deltaTime;
- ;
- y -= 0;
- z = 0;
- }
- }
- else
- {
- x = x2D;
- ;
- y = y2D;
- z = z2D;
- CameraMaxDistance = CameraMaxDistance2D;
- }
- __________________________________________________________________________
- 2D Trigger Script
- public State Types;
- public float X;
- public float Y;
- public float Z;
- public float CameraDistance;
- public enum State
- {
- Disable2D, FreezeXAxis, FreezeYAxis, FreezeZAxis
- }
- __________________________________________________________________________
- Object_Interactions Script
- if (col.tag == "2DTrigger") {
- if (col.GetComponent<Trigger2D>().Types != Trigger2D.State.Disable2D)
- {
- Cam.is2D = true;
- Cam.x2D = col.GetComponent<Trigger2D>().X;
- Cam.y2D = col.GetComponent<Trigger2D>().Y;
- Cam.z2D = col.GetComponent<Trigger2D>().Z;
- Cam.CameraMaxDistance2D = col.GetComponent<Trigger2D>().CameraDistance;
- if (col.GetComponent<Trigger2D>().Types == Trigger2D.State.FreezeXAxis)
- {
- Player.rigidbody.constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezeRotation;
- }
- if (col.GetComponent<Trigger2D>().Types == Trigger2D.State.FreezeYAxis)
- {
- Player.rigidbody.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotation;
- }
- if (col.GetComponent<Trigger2D>().Types == Trigger2D.State.FreezeZAxis)
- {
- Player.rigidbody.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation;
- }
- }
- else {
- Cam.is2D = false;
- Cam.CameraMaxDistance = -30;
- Player.rigidbody.constraints = RigidbodyConstraints.None;
- Player.rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
- }
- }
- __________________________________________________________________________
- One Way Script
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class OneWay : MonoBehaviour {
- public ColliderObject ColliderType;
- BoxCollider collisionbox;
- MeshCollider collisionmesh;
- public enum ColliderObject{
- BoxCollider, MeshCollider
- }
- private void Start()
- {
- collisionbox = GetComponent<BoxCollider>();
- collisionmesh = GetComponent<MeshCollider>();
- }
- private void OnTriggerExit(Collider other)
- {
- if (ColliderType == ColliderObject.BoxCollider)
- {
- collisionbox.isTrigger = false;
- }
- if (ColliderType == ColliderObject.MeshCollider)
- {
- collisionmesh.convex = false;
- collisionmesh.isTrigger = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement