BroDeee
BroDeee
CC#
Created by BroDeee on 3/20/2024 in #help
wall climb script
My script i made isn't working, i think its because the player has rigidbody so it cant move vertically. does someone know how to fix this? using System.Collections; using System.Collections.Generic; using UnityEngine; public class WallClimb : MonoBehaviour { public float speed; private void Start() { } private void Update() {
} private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Wall")) { Debug.Log("Touching Wall!"); Vector3 playerInput = new Vector3(0, Input.GetAxisRaw("Vertical"), 0); transform.position = transform.position + playerInput.normalized * speed * Time.deltaTime; } else { Vector3 playerInput = new Vector3(0, 0, 0); transform.position = transform.position + playerInput.normalized * speed * Time.deltaTime; } } }
1 replies
CC#
Created by BroDeee on 3/19/2024 in #help
WallClimb Script
My script i made isn't working, i think its because the player has rigidbody so it cant move vertically. does someone know how to fix this? using System.Collections; using System.Collections.Generic; using UnityEngine; public class WallClimb : MonoBehaviour { public float speed; private void Start() { } private void Update() {
} private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Wall")) { Debug.Log("Touching Wall!"); Vector3 playerInput = new Vector3(0, Input.GetAxisRaw("Vertical"), 0); transform.position = transform.position + playerInput.normalized * speed * Time.deltaTime; } else { Vector3 playerInput = new Vector3(0, 0, 0); transform.position = transform.position + playerInput.normalized * speed * Time.deltaTime; } } }
1 replies
CC#
Created by BroDeee on 3/18/2024 in #help
wall climbing script
I just started learning coding, and I'm trying to make a wall-climbing script. But I don't know how to make it not move vertically under the "else” section. Here is the piece of code.
using System.Collections; using UnityEngine; private void OnCollisionEnter2D(Collider2D other) { If (other.CompareTag(“Wall”)) { Vector3 playerInput. = new Vector3(0, Input.GetAxisRaw(“Vertical”), 0); } else { Vector3 playerInput. = new Vector3(0, Input.GetAxisRaw(“Vertical”), 0) } }
8 replies
CC#
Created by BroDeee on 3/17/2024 in #help
2d wall climbing script
I’ve been trying to get wall climbing into my 2d Unity game. But every time I do it. It fails. Can someone help me?
5 replies