CarlZalph Posted November 28, 2018 Share Posted November 28, 2018 (edited) Formula: UseScale = sqrt(DesiredScale * 300 / TextureSize) For use with: inst.AnimState:SetOrientation(ANIM_ORIENTATION.OnGround); inst.Transform:SetScale(scale, scale, scale) Purpose: Having ground textures centered on an entity scale exactly in size with in-game units rather than a seemingly arbitrary scale factor. Say you have a texture of a circle that is 512x512 pixels for its base image that has a spriter animation of it being centered. You want this to be exactly 28 units in-game. 28 units is 7 turfs side-by-side. sqrt(28 * 300 / 512) = 4.050462936504912 inst.Transform:SetScale(4.050462936504912, 4.050462936504912, 4.050462936504912) The firesuppressor_placer has an internal texture size of 1900x1900 pixels, so use 1900 for its TextureSize as an example. Note that the scale done will make it render the edge of the texture to that scale setting, so if you have a dotted line and you wanted the dot to be over the radius, add a small fluff factor to your DesiredScale to include it. Double note that if the texture is parented to an entity then you must remove the parent's scale factor from the desired as all parent scales are inherited to its children. local s1, s2, s3 = parent.Transform:GetScale() child.Transform:SetScale(scale/s1, scale/s2, scale/s3) Edited November 28, 2018 by CarlZalph Parented things. 1 Link to comment Share on other sites More sharing options...
Developer zarklord_klei Posted November 29, 2018 Developer Share Posted November 29, 2018 thanks so much, we really need a central place for data like this, as this will quickly get lost in shuffle, sad we dont have a coding wiki 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now