# What's the best math formula for changing an object's scale ratio according to its Y position?

0 favourites
• 3 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
• What's the best math formula for changing an object's scale ratio according to its Y position?

When Object.Y = 800, the object scale should be 0.1

When Object.Y = 1800, the object scale should be 1.0

with a smooth gradient between, to give the effect of a character moving as if on a 3D plane, away or towards the camera.

I tried, for example, "Every tick: Set object scale to Object.Y/1000", but that doesn't give me enough control over the perspective, as the character is far away enough from Y that the resulting change is too subtle.

Thanks!

• Set scale to lerp(0.1, 1, unlerp(800, 1800, self.y))

If you want to limit the scale in this range, you can wrap this formula in clamp(...., 0.1, 1)

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Set scale to lerp(0.1, 1, unlerp(800, 1800, self.y))

If you want to limit the scale in this range, you can wrap this formula in clamp(...., 0.1, 1)

Wow, just amazing! Thanks!

• 3 posts