|
the posted:Do I use Transform.localScale to increase the size of a gameobject? I just want it to increase in size after a collision. Yeah, that should work. Megadrive posted:I'm using ex2d with Unity to make a top-down twin stick shootem up and I'd like to know whether there's a way to use Unity's built-in Collider, Collision and Rigidbody and so on classes with my own logic to make a collision system or should I literally just roll my own using tutorials on GPWiki or something? My biggest issue is that while I know how to detection collisions between, say a circle and an AABB or whatever, I don't know to resolve collisions without using a while loop and checking collisions over and over and using a lot of computational power. Unfortunately there doesn't seem to be any obvious tutorials on the matter online. You can likely tie in Unity's system to what you need, either using OnCollisionEnter or OnTriggerEnter just to detect when a collision occurs and do your work from there. OnCollisionEnter gives a lot more information, but will continue to apply Unity's collision system unless you disable it/take the reigns right away.
|
# ? Jun 11, 2013 07:54 |
|
|
# ? Jun 13, 2024 04:13 |
|
Bondematt posted:Yeah, that should work. Alright, I did it, however it's not behaving exactly as I want. I have: JavaScript code:
|
# ? Jun 14, 2013 19:35 |
|
I don't know Unity, but by definition should't localScale be initialized to (1,1,1)? Therefore, you don't need to add 1.1, you need to set to 1.1. That is, localScale = Vector3(1.1, 1.1, 1.1). If not, you could always store the original scale in an initialization script for the entity and always do your comparisons with that.
|
# ? Jun 14, 2013 19:42 |
|
the posted:However, what that's doing is increasing it by 1.1 of it's current size every time it hits a red sphere, when I really want it to just increase by 1.1 of it's original size. How do I do that? Is there some way I can read the values of it's original size and store them into a var that I call back later? Your numbers and description just seem like you're probably misunderstanding your own problem. The simple question that would reveal if my guess is correct would be this: does the very first red sphere you touch have the effect you want it to?
|
# ? Jun 14, 2013 19:51 |
|
roomforthetuna posted:Are you sure your description is what's actually happening? If you hit 8 red spheres, is your object more than 256 times its original height? I have about 10 red spheres bouncing around in a room and one green sphere (with the script on it). With the way I had it, the sphere grows exponentially large and eventually glitches outside of the box once it hits everything because it's so huge. I'm trying to simulate the two spheres just 'merging' and becoming one that's twice the size, so I've gone the easy route and just said "annihilate one of them and grow larger" instead of trying to joint them or something (which sounds very difficult). And it's entirely possible I'm misunderstanding it. I've just logged about 20 hours total in this program so far so my knowledge isn't the best. Thank god this program has good documentation though. edit: \/\/\/ And I tried changing the += to an =, but all it did was grow the green sphere once, and then every other collision it remained it's same size. So it looks like that wasn't the answer :/ the fucked around with this message at 19:59 on Jun 14, 2013 |
# ? Jun 14, 2013 19:57 |
|
Edit: nevermind, I read the original requirement incorrectly. Orzo fucked around with this message at 20:10 on Jun 14, 2013 |
# ? Jun 14, 2013 19:58 |
|
the posted:Alright, I did it, however it's not behaving exactly as I want. I have: Shouldn't it be - JavaScript code:
|
# ? Jun 14, 2013 20:04 |
|
I would think that would shrink it? Let me try and I'll get back to you. edit: Yep, shrinked it to 10% of it's size. I think I need to do what Orzo said, which is store the original size somehow and say "if on collision, increase by original size + 1" except, I don't know how to do that.
|
# ? Jun 14, 2013 20:05 |
|
the posted:I would think that would shrink it? Let me try and I'll get back to you. Is it still set to "=" from before? Setting it = .1 would shrink it but setting it += .1 will add .1 to whatever's in there. Keeping a reference to it's original size (new Vector(1,1,1)) then setting it to origin+new Vector(.1,.1,.1) will just grow it once too. You could break it down to this though - code:
vvv Great! No problem! superh fucked around with this message at 20:15 on Jun 14, 2013 |
# ? Jun 14, 2013 20:09 |
|
By george, he's done it! Thanks, man Edit: Now, my ideal situation would be if instead of destroying the gameobject, the two objects became joined at the point of collision, which would of course be more realistic. How difficult is that to accomplish? the fucked around with this message at 20:18 on Jun 14, 2013 |
# ? Jun 14, 2013 20:14 |
|
the posted:I'm trying to simulate the two spheres just 'merging' and becoming one that's twice the size, so I've gone the easy route and just said "annihilate one of them and grow larger" instead of trying to joint them or something (which sounds very difficult). I suspect you're actually getting the result you're asking for, that the sphere is growing by 1.1 original-sphere-diameters in each dimension every time it eats a sphere. The problem is just that this is much more growth than you expect - if your original sphere is a tenth of the height of the box then after eating nine spheres, it's filling the entire box. You probably would really want to grow the sphere by approximately the volume of the sphere it ate, not its diameter. This would be localScale+=Vector3(0.26,0.26,0.26) the first time, and even smaller each subsequent time.
|
# ? Jun 14, 2013 20:21 |
|
I'm going to try to experiment with the sticking together (instead of destroying/growing) using this script. The guy wrote it in C# though, so I'll have to figure out how to translate to JS edit: There are also some posts I've read where people suggest doing a contact normal force of 9.81 (gravity) on collision. A guy wrote this script which he claims works, but it's not for me: JavaScript code:
the fucked around with this message at 21:11 on Jun 14, 2013 |
# ? Jun 14, 2013 20:44 |
|
Have you considered switching to C# yourself?
|
# ? Jun 14, 2013 21:12 |
|
Orzo posted:Have you considered switching to C# yourself? I guess I could, I've never used it though. I've been learning Unity entirely through JS. The only other language I know is Python. I hear that Unity supports Python (boo, isn't it?) but I haven't explored that either.
|
# ? Jun 14, 2013 21:14 |
|
the posted:I guess I could, I've never used it though. I've been learning Unity entirely through JS. The only other language I know is Python. I hear that Unity supports Python (boo, isn't it?) but I haven't explored that either. C# isn't all that far off from JS.. it's mostly a few fairly simple alterations in syntax. It's pretty much the superior option for Unity so you'd do well in the long run to spend a weekend forcing yourself to learn it. Even if all you do is port JS to C# it'll be instructive.
|
# ? Jun 14, 2013 21:17 |
|
Well, I got it working. They stick together now, but it's completely unrealistic. There's no angular momentum (like if you collided with another object in space and stuck, you'd start to rotate as a system). Now to figure out how to give them realistic angular momentum.
|
# ? Jun 14, 2013 21:58 |
|
I've got a question whose answer is "no". Is there any reasonably hardened and inexpensive MMO framework out there, suitable for indie games and with at least a small history of successful releases? I'm kind of looking for "Unity: MMO edition" or "UDK: MMO edition". Or even "Ogre3d: MMO edition".
|
# ? Jun 14, 2013 22:04 |
What was that thing that Space Station 13 was made in again? That's probably as close as you'll get. I think that retro-looking online final fantasy-ish thing that floats around in Games was made in the same engine. Ah, here we go, the engine is called BYOND. NEStalgia is the RPG I was thinking of. Certainly give it a shot if you're really devoted to this idea as it seemed pretty solid from my experiences with SS13 and NEStalgia. Polio Vax Scene fucked around with this message at 22:27 on Jun 14, 2013 |
|
# ? Jun 14, 2013 22:19 |
|
ZorbaTHut posted:I've got a question whose answer is "no". And thank god it is.
|
# ? Jun 14, 2013 22:23 |
|
I think you lose quite a lot by not switching to C# in Unity. I don't think Unityscript supports linq, extension methods, events, delegates, etc. I dunno about boo. I only had .net experience in VB.net before trying Unity and I picked it up easily and I'm also pretty programming dumb (literature major reporting in).
|
# ? Jun 14, 2013 22:26 |
|
the posted:I guess I could, I've never used it though. I've been learning Unity entirely through JS. The only other language I know is Python. I hear that Unity supports Python (boo, isn't it?) but I haven't explored that either. It's also my opinion that using JavaScript where C# is an option is very very silly, considering how inferior of a language it is in any context where either can be run (i.e. not in a browser). Learn C#, it won't be a mistake.
|
# ? Jun 14, 2013 22:28 |
|
Manslaughter posted:Ah, here we go, the engine is called BYOND. NEStalgia is the RPG I was thinking of. Certainly give it a shot if you're really devoted to this idea as it seemed pretty solid from my experiences with SS13 and NEStalgia. Not gonna work for me, unfortunately, I'd need 3d support for this project :/ Ah well.
|
# ? Jun 14, 2013 22:28 |
Agreeing with everyone else, learn C#. Before I knew C# I was elbow-deep in Javascript and happy with it, after I can't even look at a .js file without getting a bad taste in my mouth.quote:Not gonna work for me, unfortunately, I'd need 3d support for this project :/ Ah well. Please let us know when you have a beta for Crimson Haze II available. Polio Vax Scene fucked around with this message at 22:35 on Jun 14, 2013 |
|
# ? Jun 14, 2013 22:32 |
|
the posted:Well, I got it working. They stick together now, but it's completely unrealistic. There's no angular momentum (like if you collided with another object in space and stuck, you'd start to rotate as a system). Now to figure out how to give them realistic angular momentum. Are you following the parenting method? You need to re-add the momentum that the child force had during the collision. Using AddForceAtPosition at the position of the child in the direction of travel by using velocity * mass. You apply that to the parent rigidbody of course. It won't always spin as it may hit it just right to push it, but anything other than a direct shot should spin the new two sphere combo.
|
# ? Jun 15, 2013 00:56 |
|
So I've graduated to the cool kids club, I now work for Red Storm. Suspicious Dish posted:And thank god it is.
|
# ? Jun 15, 2013 04:03 |
|
OneEightHundred posted:Conceptually, you can make an MMO with as little as a client-server world system and a few minor centralized services (mainly transactions, inventory, and community) Which is pretty much how they all were in the days before everquest; in the form of MUDs.
|
# ? Jun 15, 2013 04:12 |
|
ZorbaTHut posted:I've got a question whose answer is "no". The closest I can think of is: http://www.smartfoxserver.com/ It's probably still "room-based" so it's not super-fluid, but if you're comfortable with zoning people around, it should be ok enough for a My First MMO.
|
# ? Jun 15, 2013 11:59 |
|
ZorbaTHut posted:I've got a question whose answer is "no". Big Worlds is the closest I can think to that and apparently there's now even an Indie version. I know some heads down startups working on it but don't know of anything major to ever ship in the US with it.
|
# ? Jun 15, 2013 16:32 |
|
HTML5 question - I want to be able to make my game do the full-screen thing, but currently I'm using things like divs with scrollable overflow for some GUI elements - I gather I can go full screen with a container rather than just the canvas, but when I do so the layout gets screwed up (a float:right div ends up centered behind the canvas). Is the answer to this issue to just absolute-position everything within the full-screen container? I gather I'll have to rearrange and rescale it all anyway when it goes full screen, since otherwise the canvas element just ends up the same size as it always was. Bonus question - can a canvas element be set up so it scales itself? ie. if I want the canvas to have its internal dimensions as 500x500, the area that I draw on, but render out to a 1000x1000 area. I realize I could do this by rendering to an off-screen canvas and then rendering that canvas onto the on-screen larger canvas, but can it be done more directly?
|
# ? Jun 15, 2013 16:43 |
|
Cross posting from the python thread, because, let's face it, you guys know more about working with game engines, and I always get more complete answers here. I have a really odd problem. I have come across an issue, and I'm not sure if the problem is in the python, or if it's in the game engine I'm using (pyglet). I decided to write my own text engine instead of using the built in methods available in pyglet. I've got this in main.py: Python code:
Python code:
Here is the relevant portion of the text_object class: Python code:
Python code:
code:
|
# ? Jun 15, 2013 17:13 |
|
I'm thinking to get a more realistic collision between two spheres I could do a force to the normal of the collision. Should I use Forcemode.force or Constantforce? Also, this may be a difficult question, but do you know of a way I could program in actual physics, i.e. Newton's law of universal gravitation giving each sphere a gravitational acceleration towards the others? I'm not sure if there's a way to say "sense every other gameobject, calculate the distance between it, and accelerate towards it at this rate." the fucked around with this message at 20:31 on Jun 15, 2013 |
# ? Jun 15, 2013 20:28 |
|
roomforthetuna posted:HTML5 question - I want to be able to make my game do the full-screen thing, but currently I'm using things like divs with scrollable overflow for some GUI elements - I gather I can go full screen with a container rather than just the canvas, but when I do so the layout gets screwed up (a float:right div ends up centered behind the canvas). Is the answer to this issue to just absolute-position everything within the full-screen container? I gather I'll have to rearrange and rescale it all anyway when it goes full screen, since otherwise the canvas element just ends up the same size as it always was. A radical suggestion: just make the webpage scale to any resolution. One major operating system already ships with a browser that's permanently in full-screen mode. "Going full-screen" is meaningless in such a situation. You could do browser sniffing and give instructions on how to toggle full-screen mode in each major browser instead.
|
# ? Jun 15, 2013 21:33 |
|
Max Facetime posted:A radical suggestion: just make the webpage scale to any resolution. One major operating system already ships with a browser that's permanently in full-screen mode. "Going full-screen" is meaningless in such a situation. You could do browser sniffing and give instructions on how to toggle full-screen mode in each major browser instead. I probably will end up doing 'manual' absolute positioning of everything based on the detected space though, because I'd like the game to work on mobile devices - arranging stuff differently for a different aspect ratio seems like a good idea too. roomforthetuna fucked around with this message at 23:00 on Jun 15, 2013 |
# ? Jun 15, 2013 22:56 |
|
What's the general solution for collaborating with Unity? All I've tried is import/export on a shared project and it's not... great. Optimally I would like it to just integrate with a VCS but from what I've found, that's Pro only?
|
# ? Jun 15, 2013 23:23 |
|
SupSuper posted:What's the general solution for collaborating with Unity? All I've tried is import/export on a shared project and it's not... great. Optimally I would like it to just integrate with a VCS but from what I've found, that's Pro only? Go into edit...project setings...editor and make sure it's set to meta files. Only put the Assets and Project Settings folders in the VCS, everything else unity can generate/regenerate on the fly. http://forum.unity3d.com/threads/141420-Unity-and-Git
|
# ? Jun 15, 2013 23:28 |
|
Merging constant big changes to a project is difficult, but if you are only working with code I found it easier to transfer the project folder as a zip and then just push / pull code changes. Here's my hgi ignore if it's helpful.
|
# ? Jun 16, 2013 00:32 |
|
So yet again I am dicking around with OpenGL and I've run into something weird. I can make some vertices and color them with VBOs. displaying the VBOs: code:
to this I have nooooo idea what's going on. all of the "duplicates" flash as well. all I'm doing is calling this code before the upper stuff. code:
|
# ? Jun 16, 2013 01:05 |
|
You're not calling gl.glClear.
|
# ? Jun 16, 2013 01:17 |
|
Orzo posted:You're not calling gl.glClear. Gaaaaahhh so stupid. Thanks.
|
# ? Jun 16, 2013 01:27 |
|
|
# ? Jun 13, 2024 04:13 |
|
the posted:Also, this may be a difficult question, but do you know of a way I could program in actual physics, i.e. Newton's law of universal gravitation giving each sphere a gravitational acceleration towards the others? I'm not sure if there's a way to say "sense every other gameobject, calculate the distance between it, and accelerate towards it at this rate." This isn't too difficult. Iterate through each object and compare it to every other object. Calculate the x and y components of the force of gravity and determine the direction(signs) if the forces. Then add the acceleration components to the base acceleration vector for the object. An iterator nested inside another iterator works well. However, this method is O(n^2) so performance blows if you have a bunch of objects to gravitate towards each other. Remember that the universal gravitational constant is really small so the force of gravity is really weak.
|
# ? Jun 16, 2013 07:51 |