|
the posted:I have 100 red spheres named sphereRed and 100 blue spheres named sphereBlue. I don't see how it's feasible to give them all different names because ... well.. that seems like it would take awhile.
|
# ? Jul 25, 2013 14:08 |
|
|
# ? May 23, 2024 20:19 |
|
roomforthetuna posted:What is it that you're trying to do by giving them different names? Why do you want to give them different names? You were asking about using the applied color to distinguish whether a sphere is red or blue, I thought, and I said you could just use the name to distinguish that. You don't need them all to have different names for this, you can use the existing name, "sphereRed" or "sphereBlue". It would actually confound this to give them all different names. Why are we even taking about giving them all different names? Probably because I brought it up due to not being clear on what he was trying to accomplish. He asked about how to tell two spheres apart that have the same name, so I suggested unique names.
|
# ? Jul 25, 2013 14:13 |
|
The OnCollision override exists on every single sphere anyway so it's already easy to tell the spheres apart. One is the collision parameter passed on the event and the other is the sphere that has had it's OnCollision event fired.
|
# ? Jul 25, 2013 14:28 |
|
poemdexter posted:The OnCollision override exists on every single sphere anyway so it's already easy to tell the spheres apart. One is the collision parameter passed on the event and the other is the sphere that has had it's OnCollision event fired.
|
# ? Jul 25, 2013 16:13 |
|
Since the sphere size is all he really cares about, I think a single if statement fixes all that.. both spheres test which one is bigger, and the smaller guy destroys himself. As a bonus I think that helps avoid race conditions if there's ever multiple collisions.
|
# ? Jul 25, 2013 16:19 |
|
roomforthetuna posted:Except that happens both ways around when there's a collision, which is why some way of distinguishing them is needed. But it doesn't need to be a way of identifying the specific red sphere, just deciding which one is more important. Comparing unique IDs seems like the best way, unless one of the goals is to have the same setup always play out identically, in which case using Unity's built in physics at all is probably a horrible idea. It doesn't matter if it plays out differently each time. How do I compare UniqueIDs? So I have the object.getinstanceid command. I'm trying to figure out how to use it. I would getinstanceid of "this sphere," and then I would getinstanceid of "that sphere." Then I could use that as the first condition! Instead of using the velocity scalar, I can just compare instanceIDs. If one is larger, then that one "wins." Then, after that, I can use size. Okay, now to figure out how to actually do this. Thanks so much guys, sorry for taking up so much of the thread. I'll post what I have when I get it written up.
|
# ? Jul 25, 2013 19:05 |
|
If I'm not mistaken, you don't want to use instanceID at all unless there's a 'tie' in all other situations. 1. Are the sizes different? The bigger one wins. 2. Are the sizes the same, but the speeds are different? The faster one wins. 3. Same size, same speed--now what? Need a tiebreaker. Use the one with the greater instanceID. You should use pastebin and paste some source code, it's much easier to help when there's actual code in front of you!
|
# ? Jul 25, 2013 19:10 |
|
the posted:It doesn't matter if it plays out differently each time. How do I compare UniqueIDs? Why does the uniqueness of the sphere matter? In my concieved collision detection it doesn't. code:
|
# ? Jul 25, 2013 19:18 |
|
^The check is going to go as follows: Did you hit a red sphere? If so, go to the next condition Are you larger? If so, you grow larger and destroy the other sphere. If you're the same size, go to the next condition Is your instance ID larger (just an arbitrary check)? If so, grow larger and destroy the other sphere.
|
# ? Jul 25, 2013 19:24 |
|
the posted:^The check is going to go as follows: It might be better to just pick randomly for the third check then. code:
|
# ? Jul 25, 2013 19:35 |
|
Here's my broke code Pastebin: http://pastebin.com/b9Kqx74y The IF statements comparing the size are incomplete because I don't know how to reference the colliding gameobject's scale. If anyone could take a look at it, that'd be awesome. Thanks. ^I might try that. edit: What I mean is, I can use transform.localscale to find THIS object's size, but how do I find THAT object's size? collision.gameobject.transform.localscale is not a thing, obviously. So I don't know how to reference the object I collided with and to find it's size. the fucked around with this message at 19:52 on Jul 25, 2013 |
# ? Jul 25, 2013 19:45 |
|
the posted:Here's my broke code Pastebin: http://pastebin.com/b9Kqx74y col.GameObject.transform.localscale should work. (I'm not in front of my Unity dev station right now) You should probably set a debug point at that collision handler and inspect the variables that you can get at runtime. That is the single most helpful thing I've ever done: being able to see what is available at runtime.
|
# ? Jul 25, 2013 19:52 |
|
KoRMaK posted:You should probably set a debug point at that collision handler and inspect the variables that you can get at runtime. That is the single most helpful thing I've ever done: being able to see what is available at runtime. And I have no idea what that sentence means.
|
# ? Jul 25, 2013 19:56 |
|
xzzy posted:It might be better to just pick randomly for the third check then. That is, the code should be code:
the posted:And I have no idea what that sentence means.
|
# ? Jul 25, 2013 19:58 |
|
the posted:And I have no idea what that sentence means. 1) in Monodevelop (and only Monodevelop) there is an icon that looks like a plug in the toolbar, when you hover over it the tooltip says "attach to process" or something like that. "attach to" will be in there. 2)click that button 3)a window with available Unity things to attach to will be available, attach to the only one available 4)set a breakpoint at the first line in the collision handler by right clicking the line and selecting breakpoint or clicking in the margin 5) go back to Unity and press the play button, when the objects collide the game will pause and monodevelop will be paused at that line. You can then evaluate variables
|
# ? Jul 25, 2013 20:04 |
|
I have a question for a project I'd like some knowledgeable folks to give me some input on. Over in the Cataclysm thread, I'm working on a system to provide electricity, so a survivor can build a generator, lay cables and power various devices. I'm considering methods to propagate power through cables at the moment and was wondering what kind of methods people would recommend. For reference, its a roguelike, and I'm only considering the 4 cardinal directions so its fairly conceptually simple but I'd like it to be as efficient and robust as possible. My current method involves, on each update, sending a on/off signal from power source objects. This would propagate recursively, skipping nodes that have already been visited, until all available nodes (i.e. power cables and electrical devices) have been visited and given the on/off signal. Is this a sound way to implement the system?
|
# ? Jul 25, 2013 23:39 |
|
PiCroft posted:Is this a sound way to implement the system? Yes. You're basically doing a flood-fill, as I understand it. You probably want to implement it with a stack rather than actual recursion though, as you'll risk blowing the call stack otherwise (depending on what language you're using) Since generators and devices are the only things that really matter, you could conceivably keep a graph structure around that stores which of these are connected to each other, and only update that when the cables are changed. But I'd be surprised if you actually needed that for good enough performance.
|
# ? Jul 26, 2013 02:03 |
|
the posted:Pretty sure they do, yes. Just your standard collision box. Each sphere is (0.3,0.3,0.3) with a collider radius of 0.5. Huh... is the collider radius going to increase when I increase transform.localscale? I think you are not understanding the people in this thread or you are leaving something key out. If you are checking red vs blue, you can give each prefab a tag of red or blue and then check for the tag on collision. If you are just checking red vs red you can use the size of the transform of the objects that are colliding and make the smaller one disappear. Does that capture every thing you are working on? Edit: Seems I missed a page! TJChap2840 fucked around with this message at 03:55 on Jul 26, 2013 |
# ? Jul 26, 2013 03:52 |
|
Just let the balls collide, they message a manager when they do, let the manager do all the decision making so it the destruction doesnt have the chance to run twice?
|
# ? Jul 26, 2013 05:48 |
|
This doesn't seem to make any sense:ERROR MESSAGE posted:Assets/spherePhysicsBlue.js(19,41): BCE0051: Operator '>' cannot be used with a left hand side of type 'UnityEngine.Vector3' and a right hand side of type 'UnityEngine.Vector3' Doing some research on the error, it looks like it pops up when you try to compare two different types (like a float and an integer). But as you can see, it's saying I'm comparing the same types. So... what the hell? EDIT: Oh, wait, I bet it's because I'm trying to compare two vectors in terms of "size," and that doesn't make sense. It pops up when I try to compare the localscale. This must mean that's a vector. So how would I take the scalar of that vector in Unity? the fucked around with this message at 05:57 on Jul 26, 2013 |
# ? Jul 26, 2013 05:52 |
|
Vector3.magnitude should be what you are looking for
|
# ? Jul 26, 2013 06:05 |
|
Bondematt posted:Vector3.magnitude should be what you are looking for Thanks, I used transform.localscale.x, which I think has the same effect (because they're uniform spheres). It looks like... it just.. might.. be workin! Thanks to all of your for your help.
|
# ? Jul 26, 2013 06:11 |
|
Again, thanks for your help. I've been monitoring the scene as I play it, and the one strange bug I mentioned earlier is happening. It appears that occasionally one larger sphere will be destroyed by a smaller one, and I can't figure out why. Here is the code that is running on all spheres. I can't see what sort of condition would ever cause a larger sphere to be destroyed. Could it be Unity somehow glitching because it's not updating the positions fast enough? (Before you ask, this is the blue sphere code, which is the same as the red with the simple name change, both are experiencing the same issue). JavaScript code:
|
# ? Jul 26, 2013 07:04 |
|
the posted:Could it be Unity somehow glitching because it's not updating the positions fast enough? (Before you ask, this is the blue sphere code, which is the same as the red with the simple name change, both are experiencing the same issue). You have an if which should be an else if
|
# ? Jul 26, 2013 09:12 |
|
the posted:I can't see what sort of condition would ever cause a larger sphere to be destroyed. Could it be Unity somehow glitching because it's not updating the positions fast enough? (Before you ask, this is the blue sphere code, which is the same as the red with the simple name change, both are experiencing the same issue). Shouldn't the check if smaller and self destroy go before the grow script? It's kind of redundant to check the scale twice. Also I'm sure this has been covered before but why the compare by name instead of by tags? I'm a unity newbie myself but I always assumed that tags were faster than a direct string comparison for names.
|
# ? Jul 26, 2013 14:00 |
|
Chance posted:Shouldn't the check if smaller and self destroy go before the grow script? It's kind of redundant to check the scale twice. Also I'm sure this has been covered before but why the compare by name instead of by tags? I'm a unity newbie myself but I always assumed that tags were faster than a direct string comparison for names. roomforthetuna fucked around with this message at 16:11 on Jul 26, 2013 |
# ? Jul 26, 2013 16:04 |
|
Gotta post my work. Another game jam game and this one is 1v1 on the same keyboard!quote:Player 1 Controls: Rumble Dogs!
|
# ? Jul 26, 2013 17:25 |
|
Forgive the newbie question but it's a long thread and I haven't seen what I'm looking for: I really liked Microsoft's XNA because I'm not a very strong programmer and I liked the way everything was set up to jump right into making something. However, I hear it's kind of dead or something. Does anyone have a recommendation for a library or environment to program in that can give me similar "jump right in" experience? C++ or C# or whatever is fine.
|
# ? Jul 28, 2013 19:54 |
|
D1Sergo posted:Forgive the newbie question but it's a long thread and I haven't seen what I'm looking for: You should look into Monogame. You can even use it with Visual Studio so it's really not that different at all. You'll need to compile your assets separately though. You can do this with an XNA project, or with this content compiler. vvv yea that too. Kibbles n Shits fucked around with this message at 20:44 on Jul 28, 2013 |
# ? Jul 28, 2013 19:58 |
|
D1Sergo posted:Forgive the newbie question but it's a long thread and I haven't seen what I'm looking for: Unity.
|
# ? Jul 28, 2013 20:10 |
|
Vinterstum posted:Unity. And the Futile library if you want to do 2D games.
|
# ? Jul 28, 2013 23:56 |
|
My Unity/Playmaker/2d Toolkit/SA Gamedev VIII project. Keeping babies out of the furnace and sawmill lines is really hard when you start panicking.
|
# ? Jul 29, 2013 00:17 |
|
Have any of you tried out Torque3d? I'd like to try making a game instead of just dicking with OpenGL, and I want to do it in linux. Or is that a lovely / unreasonable idea?
|
# ? Jul 29, 2013 00:38 |
|
Tres Burritos posted:Have any of you tried out Torque3d? I'd like to try making a game instead of just dicking with OpenGL, and I want to do it in linux. Or is that a lovely / unreasonable idea?
|
# ? Jul 29, 2013 00:44 |
|
SynthOrange posted:
Are... are the puppies supposed to go to the furnace?
|
# ? Jul 29, 2013 00:57 |
|
Besesoth posted:Are... are the puppies supposed to go to the furnace? Do you see anywhere else they can go?
|
# ? Jul 29, 2013 01:47 |
|
SynthOrange posted:Do you see anywhere else they can go? You sick man.
|
# ? Jul 29, 2013 01:50 |
|
SynthOrange posted:
Looks spiffy, I'll check it out. Thanks guys.
|
# ? Jul 29, 2013 01:54 |
|
SynthOrange posted:Do you see anywhere else they can go? A nice farm upstate, where they can chase rabbits all day?
|
# ? Jul 29, 2013 02:06 |
|
|
# ? May 23, 2024 20:19 |
|
Besesoth posted:Are... are the puppies supposed to go to the furnace?
|
# ? Jul 29, 2013 02:41 |