Hello,

I play with Mode7Driver sample, and I would like insert sprite on the road.

The documentation of playdate.graphics.image:drawSampled explain the transformation :

Draws the image as if it’s mapped onto a tilted plane, transforming the target coordinates to image coordinates using an affine transform:

x' = dxx * x + dyx * y + dx

y' = dxy * x + dyy * y + dy

[...]

For adding some trees along the road, I defined trees postions with 'world' coordinates, and calculate screen coordinates x' and y' with function:

x' = dxx * x + dyx * y + dx and y' = dxy * x + dyy * y + dy

I have this result :

Trees are on my screen ! Yeah !

But not on the side of the road: Perspective is no calculated, because z (maybe tiltAngle) are not use in this function ...

Anybody can help me to resolve my perspective problem with a magical function ?

Can I find, somewhere, drawSampled implementation to see how is work ?

Next, with good coordinates in perspective, I need also apply a scale function base on 'z' value.

But I will advance step by step

I will try to understand a very good documentation found on the site below, but mathematics is hard for me

https://www.coranac.com/tonc/text/mode7.htm

https://www.coranac.com/tonc/text/mode7ex.htm

Thank you for reading me