On each wall element I added a polygon
I added CollisionShape2d to the cat (character)
I'm new to Godot and don't understand how colliders work here, I tried to create a second identical character, but it didn't collide with the main character
I can't set up the collider for the Tilemap or Player
Asked Answered
The cat is being lerp’d in _process
rather than moved by physics, effectively bypassing collision.
This might help: https://docs.godotengine.org/en/stable/tutorials/2d/2d_movement.html
I would need to understand your setup better to say what is going wrong.
How are you moving your cat? Are you using a CharacterBody2D? What does your movement code look like?
Ridgeway
Hi, yes, I am using CharacterBody2d, my cat moves to the place where you clicked on the screen, here is my code:
extends CharacterBody2D
var speed = 2
var destination = Vector2()
func _ready():
destination = position
func _process(delta):
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
destination = get_global_mouse_position()
if position != destination:
position = position.lerp(destination, delta * speed)
The cat is being lerp’d in _process
rather than moved by physics, effectively bypassing collision.
This might help: https://docs.godotengine.org/en/stable/tutorials/2d/2d_movement.html
© 2022 - 2024 — McMap. All rights reserved.