If I understood your problem correctly, you are experiencing one of the "catches" of floating point math - it will give you results like these with a lot of decimals at the end. You're likely best off rounding your number at the end - make sure you do this as little as possible and only before you actually need to present this to the user.
As an ...
Is a platform an entity in 2D Platform in ECS pattern?
Yes, it is. *
Keep in mind that although you design your objects with tiles, only the graphical part needs to have "one sprite per tile". For example, although a platform is composed of four tiles, you do not have to have four physics "blocs" for this platform, you can extend a ...
This is pretty trivial. Just save the locked y value you want into a variable, then override the y component of your destination point with that saved value.
public float dampTime = 0.15f;
private Vector3 _velocity = Vector3.zero;
public Transform target;
private Camera _camera;
private float _fixedHeight;
// Do this once, so you're not ...
Figured out the solution. Based off of Elliot's answer from this post How do I convert from the global coordinate space to a local space?
var deltaX = Car.m_worldPositionX - PlayerCar.m_worldPositionX;
var deltaZ = Car.m_worldPositionZ - PlayerCar.m_worldPositionZ;
double deltaYaw = Car.m_yaw - PlayerCar.m_yaw;
var radius = Math.Sqrt(deltaX * deltaX + ...
My guess would be that m_worldForwardDirX/Y/Z is a unit vector pointing forward from the white car in world coordinates, and m_worldRightDirX/Y/Z is a unit vector pointing right.
If you take the position of the blue car and subtract the position of the white car, you have a difference vector in world coordinates. If you project this vector on m_worldRightDir ...
In Unity, you usually don't need to check if the movement destination is free, because collision detection and resolution can be handled by the engine. When you use rigidbody movement, then the engine will do so automatically and just not move the rigidbody when there is an obstacle in the way. Or if that object has a dynamic rigidbody, it will push it out ...
I have managed to find an answer, though I am still open to any better answers.
By adding a child object to the player, I was able to position it (by initially adding a square sprite renderer with white colour, so I could see it). I positioned this child object in the area I wanted to collide. I changed my collision detection to be based on the position of ...
First, a design question: Why. Why do you need physics? You could simply ask if the TileMap contains a certain tile that is not walkable, for example, and then, when you walk, check your character to see if he walks into that tile. The colliders seem overkill imho.
Or the other way around: why do you have the tilemap? If these were just prefabs with sprites, ...
I found a solution.
First of all, download the package in the link and put it in unity.
(required for 2D games)
Then you can follow how to do it from the link below: (Do what is explained up to the GEOMETRY OPTIONS heading.)
Finally, create a script for your object named &...
You probably figured it out by now, but I'll answer since no-one else has. Basically, it's a lambda function declaration called like:
The -> arrow part is a late return type, (just pretend what comes after gets put where the auto is).
The  brackets say what variables the function needs to know about, so it can use them. yea...should ...