blahpers Posted May 29, 2015 Share Posted May 29, 2015 Greetings, I'm creating a buildable that searches the area for entities and does stuff with them (e.g., the Flingomatic). I've managed that successfully, but now I'm trying to fine-tune the radius. What's more, I'd like to visualize this radius when placing the object (again, similar to how the Flingomatic works). However, I'm not keen on crafting preview art a few dozen times until it matches up, then tweaking the radius for a few dozen runs until it matches the preview art. Is there a better workflow for this? What's the proportion between buildable image size and in-game distance? (I assume that there's no built-in way to generate radius visualization so that I don't have to make an asset for it....) In the meantime, I'm kludging the radius tweak itself by simply placing a whole bunch of entities around the object in question and seeing which ones get affected. Ugh. Open to ideas, and thanks in advance. /* blahpers */ Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/ Share on other sites More sharing options...
DarkXero Posted May 30, 2015 Share Posted May 30, 2015 (edited) Put this in modmain:local radius = 10GLOBAL.SR = function(ra) radius = raendGLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_H, function() local pos = GLOBAL.TheInput:GetWorldPosition() for i = 0, 2 * GLOBAL.PI, GLOBAL.DEGREES do local ret = GLOBAL.SpawnPrefab("reticule") local x = pos.x + radius * math.cos(i) local z = pos.z + radius * math.sin(i) ret.Transform:SetPosition(x, 0, z) ret:DoTaskInTime(5, ret.Remove) endend)Now, when you press the H key, you will generate a circle of radius 10 around your cursor.The exact radius would be from the tip of your cursor to the middle of the "line" that contains the circle.It disappears in 5 seconds. To change radius, you open the console, and type, for example:SR(5) Now the radius is 5. You put the cursor over your thing and press H. Edited May 30, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/#findComment-642138 Share on other sites More sharing options...
Corrosive Posted May 30, 2015 Share Posted May 30, 2015 @DarkXero, You churn out code snippets so fast, I have determined that you aren't human. Since you have no avatar to confirm this, attached is an avatar-sized representation of what I suspect you might be. Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/#findComment-642164 Share on other sites More sharing options...
Seiai Posted May 30, 2015 Share Posted May 30, 2015 @DarkXero,@Corrosive, +1 vote for that to be your new avatar! Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/#findComment-642167 Share on other sites More sharing options...
Isosurface Posted May 30, 2015 Share Posted May 30, 2015 The horizontal field of view is about 37 units across the centre of screen, when you zoom all the way out. Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/#findComment-642188 Share on other sites More sharing options...
DarkXero Posted May 30, 2015 Share Posted May 30, 2015 @Corrosive, I love it.Its too big for an avatar and the signature max height is 110.But I think this way I capture it the best. Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/#findComment-642314 Share on other sites More sharing options...
Corrosive Posted May 30, 2015 Share Posted May 30, 2015 I didn't think I'd be able to get it into 90px while being legible. I had to compact "your" code a bit. Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/#findComment-642371 Share on other sites More sharing options...
DarkXero Posted May 30, 2015 Share Posted May 30, 2015 @Corrosive, there we go. Noice. Thanks. Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/#findComment-642383 Share on other sites More sharing options...
blahpers Posted May 30, 2015 Author Share Posted May 30, 2015 Put this in modmain:local radius = 10GLOBAL.SR = function(ra) radius = raendGLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_H, function() local pos = GLOBAL.TheInput:GetWorldPosition() for i = 0, 2 * GLOBAL.PI, GLOBAL.DEGREES do local ret = GLOBAL.SpawnPrefab("reticule") local x = pos.x + radius * math.cos(i) local z = pos.z + radius * math.sin(i) ret.Transform:SetPosition(x, 0, z) ret:DoTaskInTime(5, ret.Remove) endend)Now, when you press the H key, you will generate a circle of radius 10 around your cursor.The exact radius would be from the tip of your cursor to the middle of the "line" that contains the circle.It disappears in 5 seconds. To change radius, you open the console, and type, for example:SR(5) Now the radius is 5. You put the cursor over your thing and press H. That is amazing. Seriously. Can't wait to try it out. Cheers! Link to comment https://forums.kleientertainment.com/forums/topic/54579-distance/#findComment-642392 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