|
roomforthetuna posted:Weird thing in Unity, just freezing, and hitting pause in MonoDevelop for debugging shows it's just stuck in some completely trivial line - most often the constructor for a Vector2, in my code. (Trying to single step the code from that point just leaves it doing nothing, and hitting pause in the debug menu again shows it's still in the same line.)
|
# ? Dec 7, 2013 05:54 |
|
|
# ? May 26, 2024 15:07 |
|
If you are on OSX open up Activity Monitor and sample the process you'll get a (native side) callstack that might help.
|
# ? Dec 7, 2013 19:25 |
|
I have 3 3D vectors: -a unit vector giving the direction of the camera -the location of the camera -the location of an object I want to determine the angle of the object from the center of the camera (e.g. 20 degrees above, 30 degrees to the right). I haven't had much luck figuring this out with google so far, probably because I don't remember enough about working with vectors to describe it correctly. How do I do this?
|
# ? Dec 8, 2013 00:54 |
|
Zhentar posted:I have 3 3D vectors: Short answer is atan2. The long answer is that I'm on my phone but will let this related stack overflow talk for me. http://stackoverflow.com/questions/4879961/calculate-angle-from-two-points-and-a-direction-vector
|
# ? Dec 8, 2013 01:08 |
|
Zhentar posted:I have 3 3D vectors: What do you mean by above and to the right? From the camera's point of view, or from an outside observer's point of view? To put it another way: in camera space or world space? If it's world space, you can convert the vector from the camera to the object into spherical coordinates. If it's camera space, you need two more vectors: one's that describe which way is up and to the right for the camera. One of these you must specify, the other you can compute from the previous and the camera's forward direction. You can then get the cosine of the desired angles by taking the dot product of the vector from the camera to the object against those vectors. But do you really want to do all of that? You can, and it'll work, but angles are a pain to deal with. What do you actually need these angles for? Often there is an equivalent calculation you can do that involves only vectors which can save you a lot of headache. poemdexter posted:Short answer is atan2. You could make atan2 work, but that Stack Overflow answer is way over-thought. If you're trying to pan an audio source, you care about the cosine of the angle, not the angle itself. Grocer Goodwill fucked around with this message at 01:55 on Dec 8, 2013 |
# ? Dec 8, 2013 01:38 |
|
In camera space. I guess I do have a fourth vector that says which way is up for the camera. If the object is on screen, then I want to determine where it is on the screen. If it's not, then I want to determine how far off screen (in degrees, so yeah, I do need to convert to degrees at some point). edit: wait, it was the dot product thing I wanted to try, not the spherical coordinates one. Zhentar fucked around with this message at 04:52 on Dec 8, 2013 |
# ? Dec 8, 2013 03:36 |
|
Another Unity debugging bastard thing, that the debug log frame doesn't update very frequently at all, making even the equivalent of the "print that you got here" debugging method unhelpful for these freezey bugs - I was outputting a y coordinate to find where the problem was, and the last one output on screen at the time of the freeze was 1.2, but the actual problem was several frames later, like Debug.Log was subsequently called on 1.2, 1.3, 1.35, 1.4, 1.5, 1.55 when I was single-stepping the code, before the crash during 1.55's processing. Makes it hard to frame a recreation for debugging when you can't get the bastard to output the moment before it happens. I might have to implement a GUI console sort of thing just for sticking debug values on the screen a bit more reliably. I'm out of bugs that are reliably enough reproduced to detect otherwise. Which is good, I suppose!
|
# ? Dec 8, 2013 07:31 |
|
That particular instance is why I frequently use the build and run function, then check the last line of the debug text file.
|
# ? Dec 8, 2013 07:34 |
|
roomforthetuna posted:Another Unity debugging bastard thing, that the debug log frame doesn't update very frequently at all, making even the equivalent of the "print that you got here" debugging method unhelpful for these freezey bugs - I was outputting a y coordinate to find where the problem was, and the last one output on screen at the time of the freeze was 1.2, but the actual problem was several frames later, like Debug.Log was subsequently called on 1.2, 1.3, 1.35, 1.4, 1.5, 1.55 when I was single-stepping the code, before the crash during 1.55's processing. Makes it hard to frame a recreation for debugging when you can't get the bastard to output the moment before it happens.
|
# ? Dec 8, 2013 15:56 |
|
Shalinor posted:Get DebugConsole. It's a way better output target for debug spew (it doesn't freeze your execution), and it also gives you support for customizable console commands - which I've been abusing lately, since I have no UI still At last, stage one of my lighting is complete and working - 2D 'volumetric' lighting using neither raycasts nor premium features. Its main weakness versus other options right now is it can't do coloured lights or lights adding up when they overlap (both of which would be dead easy with Pro, but require insane complexity without it). Its strengths include being super precise (no flickery edges as many raycasting options have), maybe relatively fast (I suspect slower when there's many complex objects casting shadows, but faster in sparse or simple conditions), and being able to cast lights 'onto' surfaces, with a "penetration distance" value. And being able to be properly "you can't see anything" dark - not sure whether the 2D Volumetric Lighting asset store guy's one can do that or not, it doesn't do it in the demos and I suspect it operates on some shader tomfoolery that means it can't do it. One more relatively simple feature to add, making the light do an area of full brightness before the fadeoff (separating "inner radius" and "outer radius" - currently it only does either full brightness throughout or constant fadeoff) and it'll be ready to be seen. This brings up a question for me though - is there really no compile-time toggle (like a #ifdef) for whether you have Pro or not? I'd want to compile "lovely best I can do workaround" version for non-pro users and "much simpler and faster rendertarget-based" version for pro, but not as distinct files because most of the code is still shared, and a runtime toggle seems dumb and inappropriate for something like that. Edit: I suppose an if (SystemInfo.supportsRenderTextures) or five every frame probably isn't all that much of a resource drain, and has the dubious extra advantage of also properly handling some sort of crazy hardware configuration that's capable of doing all this tricky rendering poo poo but somehow not capable of doing rendertargets. roomforthetuna fucked around with this message at 06:30 on Dec 9, 2013 |
# ? Dec 9, 2013 06:15 |
|
Is the promised GUI stuff update going to part of Unity 4.x, or is that going to be on another full number update? I'm dithering on whether to get Pro or not; I don't want to be spending $1500 only to have it cost another $750 later to get an update that makes it properly usable. (This makes me glad I didn't get Pro last time I was considering it, pre version 4, since now I'd be out another $750 or more to get 2D - not sure making people feel "glad I didn't pay earlier" is good marketing strategy! I suppose "surprise, you're not done paying like you thought!" is pretty effective though.)
|
# ? Dec 9, 2013 17:11 |
|
roomforthetuna posted:Is the promised GUI stuff update going to part of Unity 4.x, or is that going to be on another full number update? It will be in the 4.x release cycle. quote:I'm dithering on whether to get Pro or not; I don't want to be spending $1500 only to have it cost another $750 later to get an update that makes it properly usable. (This makes me glad I didn't get Pro last time I was considering it, pre version 4, since now I'd be out another $750 or more to get 2D - not sure making people feel "glad I didn't pay earlier" is good marketing strategy! I suppose "surprise, you're not done paying like you thought!" is pretty effective though.)
|
# ? Dec 9, 2013 22:07 |
|
The new UI may not be anything special anyway. From the presentation on it I think its going to be fairly bare bones and it might end up like mecanim where its broken for a few releases after the initial. Spending some bucks you can get NGUI now which is already the new UI but with more features, try 2DToolkit's UI which I've heard good things but have no experience, or try DF-GUI which similar to NGUI but way more straight forward in its config/setup yet also newer and rougher in some ways.
|
# ? Dec 9, 2013 23:37 |
|
FuzzySlippers posted:The new UI may not be anything special anyway. From the presentation on it I think its going to be fairly bare bones and it might end up like mecanim where its broken for a few releases after the initial. (which won't be for months and months yet, so just use NGUI for your current project and think about Unity GUI for your next, basically)
|
# ? Dec 10, 2013 15:30 |
|
Does anyone see any way of making a shader like this run faster on handhelds?code:
It's bottlenecking me pretty hard on Android when I have a lot of things displayed as almost everything in my game uses this shader, or a near identical one that uses per vertex colours, but I can't think of any way of making the shader more efficient or coming up with some different way of getting a similar effect.
|
# ? Dec 11, 2013 20:46 |
|
I'm not much of a graphics guy but that branch in the fragment shader is probably not doing you any favors.
|
# ? Dec 11, 2013 20:53 |
|
xgalaxy posted:I'm not much of a graphics guy but that branch in the fragment shader is probably not doing you any favors. That's how the algorithm works though, he kinda needs the branch for what he's doing. Hmm, I'm trying to think of some way you can precompute something but I'm not coming up with much. But, do you really need it to be this robust? To be able to manually determine when each pixel blinks out? I'm thinking you could accomplish the same thing with like a mask or randomness or something, although I don't even know if that would be faster... Doing that per-pixel for every object on the screen just may not be viable for mobile. I've only poked around with shaders a bit though so what do I know
|
# ? Dec 11, 2013 21:44 |
|
Contains Acetone fucked around with this message at 17:38 on Jun 24, 2020 |
# ? Dec 11, 2013 22:08 |
|
Spek posted:Does anyone see any way of making a shader like this run faster on handhelds? What size is your noise texture? The shader doesn't look particularly complicated. You can try flattening the branch, like others have suggested, but if I had to guess, I'd suspect you're thrashing the texture cache with that noise texture. As an aside, how are you using depth in your game? In general when computing a screen-space position, you need to do the w divide in the pixel shader, unless you know that all the vertices in a triangle will always have the same depth. If you're entirely 2D, you can use an ortho projection and skip the w divide altogether.
|
# ? Dec 12, 2013 01:03 |
|
Thanks allGrocer Goodwill posted:What size is your noise texture? The shader doesn't look particularly complicated. You can try flattening the branch, like others have suggested, but if I had to guess, I'd suspect you're thrashing the texture cache with that noise texture. I do use depth but pretty much everything falls into 3 depth layers, background, play area, GUI. I'm not sure if I can take advantage of that to get more speed up. In theory the only things that need to be sorted against eachother are the things rendered in the same one of those 3 depth layers. The w divide is just used in mapping the noise texture to screen space for pixel perfect tiling of the noise texture. I have no idea how/why it works I figured it out through trial and error months ago and didn't understand it then, I understand it even less now. Contains Acetone posted:If the branch is actually the bottleneck, you can get the same result doing: Prior to trying either of these I was getting 25fps in the test scene I was using. With the second snippet it went to 35fps, so the branch is clearly one of the bottlenecks. With the first snippet I get 30fps and it looks just as good as my original. 5fps gain with no loss in quality that I can see. Thanks! I would have assumed that a max() function would contain a branch in it. What wizardry lets that be faster than if()?
|
# ? Dec 12, 2013 02:33 |
|
Instructions like fsel (and their equivalent in the GPU instruction set) let you put one of two values in a register without inserting pipeline bubbles or dealing with threads diverging.
|
# ? Dec 12, 2013 03:17 |
|
Probably the biggest performance gain would be to work out which game objects actually need the shatter effect each frame, and only use this shader for the ones that are actually shattering. Use a simpler (but equivalent) shader for the ones that are completely cohesive. (I'm assuming all game objects can shatter, but not all will be in the process of doing so each frame, which seems likely from what I remember you posting. If really everything is shattering all the time, I guess this isn't helpful.)
|
# ? Dec 12, 2013 03:29 |
|
Contains Acetone fucked around with this message at 17:37 on Jun 24, 2020 |
# ? Dec 12, 2013 18:42 |
|
I was told at one point that lerp can do the same sort of trick, although I think I heard later that it can depend on hardware/drivers/API/whatever if it works or not.
|
# ? Dec 12, 2013 22:49 |
|
How do I make Unity's editor camera controls not absolute dogshit? I don't know how people work in this. edit: Okay that wasn't particularly constructive. But WASD only works intermittently at best (and yes I'm holding down RMB), and hitting 'F' instead of focusing the camera on whatever object tends to send it careening off in random directions, making the objects invisible. edit 2: looks like 'W' fails if you're already holding shift. But only sometimes? Paniolo fucked around with this message at 08:02 on Dec 17, 2013 |
# ? Dec 17, 2013 07:43 |
|
Paniolo posted:How do I make Unity's editor camera controls not absolute dogshit? I don't know how people work in this. Hold right mouse button to rotate around. Hold middle mouse button to translate around. Shift + hold middle mouse button to translate faster. Scroll middle mouse button for zoom in/out. F focuses on whatever you have selected in the hierarchy. QWER buttons are hotkeys for the various things you can do to objects in scene view. Holding right mouse button and WASD has never been intermittent for me, and hitting F has never given me trouble. Sounds like you have some really weird issues. Are you on latest?
|
# ? Dec 17, 2013 08:18 |
|
Hey folks! Me and a couple of friends are developing an app (for iOS and Android) during the next 4 months. I came by to check if anyone has used xARM, a resolution 'preview' plugin. My current line of thought is basically just that this might speed up the process pretty much, since we have a deadline. I also don't own the many different devices needed for testing. The main benefit would probably be to make sure our GUI etc is resolution-independent, and seeing more resolutions at the same time would be a nice thing. Anyone got any experience with this very plugin or got any other recommended plugins?
|
# ? Dec 17, 2013 10:59 |
|
Paniolo posted:How do I make Unity's editor camera controls not absolute dogshit? I don't know how people work in this. Try using the orthographic camera mode, it acts like a standard orbit camera then. Click the cube of the view-cube to switch between the two.
|
# ? Dec 17, 2013 12:39 |
|
poemdexter posted:Holding right mouse button and WASD has never been intermittent for me, and hitting F has never given me trouble. Sounds like you have some really weird issues. Are you on latest? The Scene window acts differently depending on whether the mouse cursor is inside it's rectangle or not. Make sure it is if you want to do stuff like F. If you want to use WASD, you have to right click on the window first. It took me forever to figure out why F use was so inconsistent.
|
# ? Dec 17, 2013 14:20 |
|
Hey guys! Did anybody here do ludum dare? antinumeric and I did the 72 hour game jam and made a little action platformer in unity (although apparently it's hard as balls, who'd have thought >_>). http://www.ludumdare.com/compo/ludum-dare-28/?action=preview&uid=30298 Give it a look if you're interested. Unity 2d actually made it really pretty easy to do - all the code was written from scratch, and stuff like a checkpoint system was surprisingly easy to implement.
|
# ? Dec 17, 2013 16:03 |
|
Obsurveyor posted:The Scene window acts differently depending on whether the mouse cursor is inside it's rectangle or not. Make sure it is if you want to do stuff like F. If you want to use WASD, you have to right click on the window first. I think I've figured it out. If you hold down shift before pressing W it does not work; if you press W first it does. It felt intermittent because I'd hit shift and W at the same time, and depending on which registered first it would work or not work.
|
# ? Dec 17, 2013 16:35 |
|
Paniolo posted:I think I've figured it out. If you hold down shift before pressing W it does not work; if you press W first it does. It felt intermittent because I'd hit shift and W at the same time, and depending on which registered first it would work or not work. It doesn't matter which order you do shift + W. What does matter is that W is a shortcut for activating the translation tool, so if you press W when the right mouse key isn't down, you're using a shortcut, not moving. (Q is the Pan shortcut, W is the translation shortcut, E is the rotate shortcut and R is the scale shortcut)
|
# ? Dec 18, 2013 22:03 |
|
Shalinor posted:If that's how it works for you, you would appear to have a keyboard with multi-keypress issues. Its called 'ghosting'. But shift ghosting is weird, usually even cheap keyboards put metas on a different rail...
|
# ? Dec 18, 2013 23:56 |
|
I've got a high end gaming keyboard and only have that issue with the W key.
|
# ? Dec 19, 2013 02:36 |
|
Finally got a decent demo of my "volumetric 2D lighting" working. Versus the one in the asset store, mine supports total darkness (I don't know if his does or not, but none of the demos show it and I suspect it might work in a way that precludes it) and self-illuminating objects, and, probably more importantly, mine does almost no raycasting. The asset store one beats mine in its ability to have lights combine additively and be of different colors (both of which mine could easily do with Pro, but it's not worth the insane effort required to make it do that with the way it works when there's no rendertargets). I think the soft edges on mine are also something the other one can't do without Pro. Demo here. You can drag and select lights from approximately their center-point. The other objects aren't in any way the only things that would work with the lights, they're just samples of the three main kinds of 2D colliders - circle, box and poly. The shadows also work with paths, but I didn't bother showing those because the implementation is identical to a simple poly anyway, and paths are arse to draw since they have no area.
|
# ? Dec 23, 2013 01:23 |
|
In Unity, I want a 2D AI to know when it's up against a wall. Which would be less resource-intensive, Raycasting or putting collision triggers on either side of the AI? I generally know the steps taken to check for collision with a box/sphere in 3D, but I've never used raycasting before, so I don't know whether that has more or fewer steps.
|
# ? Dec 24, 2013 20:28 |
|
Cheston posted:In Unity, I want a 2D AI to know when it's up against a wall. Which would be less resource-intensive, Raycasting or putting collision triggers on either side of the AI? I generally know the steps taken to check for collision with a box/sphere in 3D, but I've never used raycasting before, so I don't know whether that has more or fewer steps. My personal preference is for using Linecasts instead. Usually as part of a character controller that is then running a state machine that movement, animation and AI can all query for their own needs.
|
# ? Dec 25, 2013 01:59 |
|
Cheston posted:In Unity, I want a 2D AI to know when it's up against a wall. Which would be less resource-intensive, Raycasting or putting collision triggers on either side of the AI? I generally know the steps taken to check for collision with a box/sphere in 3D, but I've never used raycasting before, so I don't know whether that has more or fewer steps. It might also be viable to use one of the Physics2D.OverlapCircle or Physics2D.OverlapPoint or Physics2D.OverlapArea series rather than a raycast. But really, the difference in resource-intensive-ness of these options, unless you're having hundreds of things checking for collisions, is so small that you almost certainly shouldn't even be worrying about it. Just do whatever is easiest to get the result you want.
|
# ? Dec 25, 2013 13:35 |
|
Does anybody know why this pursue function fails to recognize that its target is ahead and facing it if they are nearby?code:
|
# ? Dec 26, 2013 05:59 |
|
|
# ? May 26, 2024 15:07 |
|
Lork posted:Does anybody know why this pursue function fails to recognize that its target is ahead and facing it if they are nearby?
|
# ? Dec 26, 2013 06:59 |