Alienhead Posted April 28 Posted April 28 Ability to line pick material on a terrain. Quote Alienhead Components and Software
Josh Posted April 28 Posted April 28 You can get the materials that are in use at any terrain point with these commands: https://www.leadwerks.com/learn/Terrain_GetLayers https://www.leadwerks.com/learn/Terrain_GetLayerWeight 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Alienhead Posted April 28 Author Posted April 28 Any advice on this GetLayers() command? All I get back is an Read Pixel Out of Bounds error. Also the docs show sending coords x and y on a 3d terrain ? Should I be sending x and z? local tbl = terrain:GetLayers(self.entity:GetPosition().x, self.entity:GetPosition().z) Quote Alienhead Components and Software
Josh Posted April 28 Posted April 28 The coordinates are the X and Y coordinate of the terrain, not the world position. The lower-left corner of the terrain is coordinate 0, 0. World position to terrain coordinate is usually something like this: int x = Round( (pos.x - terrain->resolution.x / 2) / terrain->scale.x ); int y = Round( (pos.z - terrain->resolution.y / 2) / terrain->scale.z ); x = Clamp(x, 0, terrain->resolution.x - 1); y = Clamp(y, 0, terrain->resolution.y - 1); 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.