Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { public float movespeed = 5f; public Transform movePoint; public LayerMask whatStopsMovement; // Start is called before the first frame update void Start() { movePoint.parent = null; } // Update is called once per frame void Update() { transform.position = Vector3.MoveTowards(transform.position, movePoint.position, movespeed * Time.deltaTime); if(Vector3.Distance(transform.position, movePoint.position) <= .05f) { if(Mathf.Abs(Input.GetAxisRaw("Horizontal")) == 1f) { if(!Physics2D.OverlapCircle(movePoint.position + new Vector3(Input.GetAxisRaw("Horizontal"), 0f, 0f), 2f, whatStopsMovement)) { movePoint.position += new Vector3(Input.GetAxisRaw("Horizontal"), 0f, 0f); } } if(Mathf.Abs(Input.GetAxisRaw("Vertical")) == 1f) { if(!Physics2D.OverlapCircle(movePoint.position + new Vector3(0f, Input.GetAxisRaw("Vertical"), 0f), 2f, whatStopsMovement)) { movePoint.position += new Vector3(0f, Input.GetAxisRaw("Vertical"), 0f); } } } } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)