ID:1633686
 
(See the best response by Ter13.)
Following on from This I've come into a logic issue I can't wrap my head around.

For the quick version, here, I have a viewer mob which locates itself between two players and each players client.eye is set to it. This means the camera is effectively centered between the two players

See it works fine, but because of how locate() works, it doesn't account for step_x and step_y. That's to say, once I move one full tile away from the other player, the viewer proceeds to move. It doesn't move with my pixel movement, which is what I intended.

I cannot think of a way of locating a position between two atoms, then taking into account their step_x and step_y, and then smoothly moving towards them.

Help would be appreciated.
Best response
Pretty simple:

#define TILE_WIDTH 32
#define TILE_HEIGHT 32


//getting the midpoint:
var/x1 = (A.x + A.step_x / TILE_WIDTH)
var/y1 = (A.y + A.step_y / TILE_HEIGHT)
var/x2 = (B.x + B.step_x / TILE_WIDTH)
var/y2 = (B.y + B.step_y / TILE_HEIGHT)
//find the delta
var/dx = x1 - x2
var/dy = y1 - y2
//now you can find the center:
var/cx = dx/2 + x1
var/cy = dy/2 + y1

//Convert it back to tile/pixel format:
var/tx = round(cx)
var/ty = round(cy)
var/px = (cx - tx) * TILE_WIDTH
var/py = (cy - ty) * TILE_HEIGHT
Sorry if you misunderstood, my title was pretty misleading, it's not the actual finding of two points between two atoms, it's the actual moving specifically to those points.
Given the coordinates of tx/ty and px/py, there should be no problem. I don't understand the problem if you don't have any trouble calculating the tile and pixel offsets. Can you explain further?
Ok, if you check the thread I linked you can see the system I have right now, every 0.1 ticks it loops and moves the viewier towards the specified location, now in order to retain it being smooth I've made it so that the viewer moves faster the further from the player that it gets, but I still want to retain it within a tile's accuracy.

How can I manage to move the viewier to the center including pixel offset to within 64 pixels smoothly. Like, my brain isn't working to tell me an efficient and easy way to make it speed up when far from the client and slow down when close to the client but still make it accurate to 64.
What you need to realize is that "smooth" is a misnomer. It's arbitrary. So long as your motion is consistent, "smooth" will be a non-issue.

There's no trick, simply move it once per tick along the delta by one unit.

The problem you are running into, is that you are trying to use built-in functions to move the eye, instead, you need to locate() according to the tx/ty values I showed you how to get, and then set the step_x and step_y every frame to the px/py values I showed you how to get.
Could I not check the px/py, if they're under 20 then step() 2 (If under 2, step() 1) and if over 20 step 20?

Thanks by the way.