Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.


Popular Content

Showing content with the highest reputation on 06/29/2019 in all areas

  1. 1 point
    yeah its actually very simple to do but here you go: using UnityEngine; public class Peek : MonoBehaviour { public Transform cam; public Transform cam2; private float nextPos; private float nextPos2; private float dampVelocity; private float dampVelocity2; void Update() { float newPos = Mathf.SmoothDamp(cam.transform.localPosition.x, nextPos, ref this.dampVelocity, 0.2f); float newPos2 = Mathf.SmoothDamp(cam.transform.localPosition.y, nextPos2, ref this.dampVelocity2, 0.2f); float newPos3 = Mathf.SmoothDamp(cam2.transform.localPosition.x, nextPos, ref this.dampVelocity, 0.2f); float newPos4 = Mathf.SmoothDamp(cam2.transform.localPosition.y, nextPos2, ref this.dampVelocity2, 0.2f); cam.transform.localPosition = new Vector3(newPos, newPos2, cam.transform.localPosition.z); cam2.transform.localPosition = new Vector3(newPos3, newPos4, cam2.transform.localPosition.z); if (Input.GetKey("x")) { nextPos = 0.7f; nextPos2 = 0.0f; } else if (Input.GetKey("z")) { nextPos = -0.7f; nextPos2 = 0.0f; } else if (Input.GetKey("c")) { nextPos = 0.0f; nextPos2 = 0.0f; } else { nextPos = 0.0f; nextPos2 = 0.0f; } } /* [RPC] //Rpcs are not supported anymore since raknet got removed from unity use UNET or some other networking soulution (TNet is like raknet if you want a quick convert) void Test() {} */ } by the way i would not use the code the way it is it looks hacked together and will be pretty inperformant. Also there are no Remote procedure calls like that anymore, if you want to have networked methods you have to do it differently, wrote a quick comment on the side.
  • Create New...