Hi!
I posted this on the forum, but I figured maybe it’s best to post it here.
Anyway, I’m gonna try to describe this as best I can.
What I’ve got:
I’m working on a 2D game. The character is moving 1 unit per frame along the X axis. The main camera isn’t attached to the character itself but handled by a different blueprint. That blueprint consists of a collision box and a camera. That blueprint is also moving with the same speed, 1 unit per frame. The character can teleport (Using SetActorTransform) 32 units per pressed key using WASD. The characters collision capsule is set to no collision, but query only and thus can fire overlap events. If the character is colliding with an object on the tilemap, it’s speed is set to 0 units per frame. The character then stops, but the blueprint with the collision box and camera is still moving 1 unit per frame. Meaning that if the player doesn’t move the character out of the way of the object, the character is pushed out of the screen. If this happens, the player dies and the level restarts.
What I want to do: (TL;DR)
I can still teleport through walls. I want to check what my next position will be, and if there is collision only move up until the point of collision and obviously not through walls. As I mentioned previously the teleporting is handled by SetActorTransform and simply adding/subtracting 32 units to the actors current transform.
I hope this post isn’t too confusing. I can provide some screenshots later today if that helps!
Thanks!