Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Alternative to using transform.translate and transform.position for moving objects exact values?

$
0
0
Is there a way to move an object a certain amount without using transform.position or transform.translate? I'm working on something that would look like the game Rogue, with ASCII art-esque sprites. I'm using a simple script to make the player move, just using transform.position to move them. However, both transform.position and transform.translate ignore box colliders, like those I've set on the player and the walls in the level I've built. If it would help if I post my code, I definitely can. I just want to know if there was a way to move the player an exact amount that still respects box colliders. Alternatively, if there isn't a good way of doing this, would there be a way to build this entirely with something like a textmesh? And, in Javascript, how would that work? Update: I've tried using Rigidbody2D.velocity and such, but it always comes up slightly off, blocking the player from moving into exact areas, and after a while of movement, becoming noticeably off the grid.

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>