• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=huntingrifle;47163266]Hey guys, since my question is about Unity, I thought this would be the right place to ask (Quoted to take up less space). So I was wondering, does anyone have any ideas as to how to do this? It'd be greatly, incredibly appreciated.[/QUOTE] Given that we're all using Unity for our own games, and if we wanted people accessing raw assets we'd provide them ourselves, I'm not sure this is the best place to ask this E: I might be entirely wrong though, so hang around and see what everybody else thinks
This is true, but I'm not planning on doing anything with the assets I acquire for anything other than personal use, and even then I'll be crediting the original authors because it's their, and I don't plan nor want to make money off of anyone else's work. Typically, whenever I get any game assets, I like to mess around with the models and animations, render something decent, and pretty much scrap the content once I'm done. It's just that Unity is the only engine I can't do this from. Nonetheless, if it can't be done or Unity developers would rather I didn't do this, then by all I means I will stop.
Question to all of you gentlemen... What are your preferences when construction the main menu? I mean, holding it in a separated scene or in the same scene/level as everything in the game takes place in. For now I'm holding mine in a separate scene from the game.
[QUOTE=Dromlexer;47163610]Question to all of you gentlemen... What are your preferences when construction the main menu? I mean, holding it in a separated scene or in the same scene/level as everything in the game takes place in. For now I'm holding mine in a separate scene from the game.[/QUOTE] Separate scene, always.
Wondering if this is possible: grab an image from a file using the WWW object, get the read bytes, encode to Unity's texture format on a separate thread (which means, without using the Unity API), then bring it back to the main thread and make a Texture2D out of it. The encoding step is where I'm not sure what to do, are there libraries for this? Right now I do everything on the main thread using standard Unity functionality, but it freezes the game while for a split second since it's encoding the image to a texture. Which sucks when you're using the Oculus Rift and load a boatload of external images into your application.
How do you set the material of a richtext quad? [url]http://docs.unity3d.com/Manual/StyledText.html[/url] [code] <quad material=1 size=20 x=0.1 y=0.1 width=0.5 height=0.5 />[/code] [quote]The value is an index into the text mesh’s array of materials as shown by the inspector.[/quote] What do they mean? What text mesh? I want sprites in a GUI.box - basically I'm trying to put coin-symbols in my tooltip, like in this picture at the bottom: [img]http://media.mmo-champion.com/images/news/2012/november/newTooltips.png[/img]
Any reasons why this is happening. Basically why isn't the line reaching the actual point V2 ( -5,0). Well the line is suppose to reach -5 but it looks like it stops at -3. [code] private Vector3 transformPos; void Awake() { transformPos = this.transform.position; } void Update() { Debug.DrawLine(transformPos, new Vector2(transformPos.x - 5, transformPos.y), Color.red); Debug.DrawLine(transformPos, new Vector2(transformPos.x + 5, transformPos.y), Color.green); } [/code] [img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-18_17-57-25.png[/img]
Is transformPos.x = 0 in the first place? Your endpoint vector is (transformPos.x - 5, transformPos.y, 0) and not (-5,0,0). If you get (-3,0,0) then your GameObject should be located at (2,0,0).
Yes transformPos.x is 0 and the Line still looks like it was moved only 3 units. I also tried to debug the end value. [code] Debug.Log(new Vector2(transformPos.x - 5, transformPos.y)); /*Result*/ (-5.0,0.0); [/code]
How would I go about getting rid of all this grey space around my 2d game? I'm doing it to learn C# and Unity since I've already coded Flappy Bird in Lua with Love2D and a non-completed web version in Javascript [img]http://i.gyazo.com/33350e8fe0eda6d1b30c47fc28c122df.png[/img]
[QUOTE=Clavus;47165027]Wondering if this is possible: grab an image from a file using the WWW object, get the read bytes, encode to Unity's texture format on a separate thread (which means, without using the Unity API), then bring it back to the main thread and make a Texture2D out of it. The encoding step is where I'm not sure what to do, are there libraries for this? Right now I do everything on the main thread using standard Unity functionality, but it freezes the game while for a split second since it's encoding the image to a texture. Which sucks when you're using the Oculus Rift and load a boatload of external images into your application.[/QUOTE] Are you using [url=http://docs.unity3d.com/ScriptReference/WWW.html]this[/url] method with the coroutine? If that's what you're using, you could try [url=http://asimmittal.blogspot.com/2014/05/threading-in-unity-with-loom.html]Loom[/url].
[QUOTE=Exho;47167636]How would I go about getting rid of all this grey space around my 2d game? I'm doing it to learn C# and Unity since I've already coded Flappy Bird in Lua with Love2D and a non-completed web version in Javascript [img]http://i.gyazo.com/33350e8fe0eda6d1b30c47fc28c122df.png[/img][/QUOTE] Press in the Free aspect list box and select a custom resolution that fits to your standars
[QUOTE=Why485;47160160]What does the yellow line mean? Are you selecting a target by target closest to the selection ray or those things in a list somewhere? I'm curious because I've had to do the same thing (target under the crosshair) but I took a totally different approach. I just got the angle off the nose of every valid target and then just targeted whatever had the smallest angle. [editline]17th February 2015[/editline] Look up how to do event systems and delegates. In my previous project, Every ship had an explosion event listener and whenever a missile caused an explosion event, the ships with listeners on them would just check how far away they were and apply damage accordingly.[/QUOTE] I was just looking at event systems and delegates and they seem pretty straight forward. My question is how would you detect how far away is the missile from the ship in your case. Would I do on the ship something like... [code] float distance = Vector2.Distance(GameObjectWithTag("Missile").transform.position, transform.position); [/code] [editline]19th February 2015[/editline] [QUOTE=foszor;47160218]Assuming your grenade already has a solid collider (so it can bounce and interact with the world) you could create a child object on the grenade with a circle collider. Flag it as a trigger, set the radius to the explosion size and use the colliding objects to do damage. You could add a damage falloff based on the distance from the center of the grenade. This is probably the simpler solution over using an OverlapsArea or any raycasting.[/QUOTE] What would I use to calculate the distance? I can't really use raycasts cause they don't go through objects, so I would use something like.. [code] //This code is on the grenade void OnTriggerEnter2D(Collider2D collider) { float distance = 0; if (collider.tag == "Enemies") { distance = Vector2.Distance(collider.transform.position, transform.position); collider.GetComponent<EnemyController>().TakeDamage(200 / distance); } } [/code] Haven't tested any of this code, I just wrote it here just so I know if this is the right approach.
I noticed you can't Instantiate something in OnDestroy() if you change scenes. What happens when a scene is changed? This makes me think all gameobjects are Destroy() when a scene is changed and so I was getting an error because it couldn't instantiate since the scene was changing. But I don't know for sure since the error was vague and only asked if I'm creating something in OnDestroy()? I fixed this error from occurring by moving it out of OnDestroy().
[QUOTE=Kidd;47172911]I noticed you can't Instantiate something in OnDestroy() if you change scenes. What happens when a scene is changed? This makes me think all gameobjects are Destroy() when a scene is changed and so I was getting an error because it couldn't instantiate since the scene was changing. But I don't know for sure since the error was vague and only asked if I'm creating something in OnDestroy()? I fixed this error from occurring by moving it out of OnDestroy().[/QUOTE] Scene change does destroy all gameobjects by default. You can change this on a per gameobject basis with this method [url]http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html[/url]
Monodevelop's auto code formatting is the most frustrating thing... Let me format my own code the way I want damnit
[QUOTE=Exho;47174936]Monodevelop's auto code formatting is the most frustrating thing... Let me format my own code the way I want damnit[/QUOTE] You can configure it in the options, it takes a few minutes but I managed to get mine working how I wanted it.
So, seeing as I've never done something like this before, how would I make this model appear as if it's inside the block, rather than rendering outside of it? The model itself is actually inside the block, the only thing poking out is the staff. [t]http://puu.sh/g4VeL/4d300a07f3.png[/t]
[QUOTE=foszor;47167677]Are you using [url=http://docs.unity3d.com/ScriptReference/WWW.html]this[/url] method with the coroutine? If that's what you're using, you could try [url=http://asimmittal.blogspot.com/2014/05/threading-in-unity-with-loom.html]Loom[/url].[/QUOTE] The bottleneck isn't loading the file into the WWW object (because yes I use a coroutine there), it's re-encoding the loaded PNG / JPG image to a Texture2D. Loom makes it easier to multi-thread but it doesn't allow you to use Unity API methods on separate threads (it requires you to dispatch them back to the main thread). The encoding can only be done on the main thread and there doesn't seem to be a way of doing it in a coroutine. One idea I have is that I run a separate Unity instance purely for loading / re-encoding the images, and then somehow transfer the Texture2D object from that Unity instance to the main one, but I have no idea how I would go about doing that.
[QUOTE=LuckyLuke;47177255]So, seeing as I've never done something like this before, how would I make this model appear as if it's inside the block, rather than rendering outside of it? The model itself is actually inside the block, the only thing poking out is the staff. [t]http://puu.sh/g4VeL/4d300a07f3.png[/t][/QUOTE] What shader does the model and the block use?
[t]http://i.imgur.com/zPoejI3.png[/t] I love team fortress. I really do. So I decided to start a side project and try to recreate it while fixing/changing some things. And before anyone asks, yes, that is my poor rendition of ctf_orange!
Is that cell shading?
[QUOTE=BoowmanTech;47170944]I was just looking at event systems and delegates and they seem pretty straight forward. My question is how would you detect how far away is the missile from the ship in your case. Would I do on the ship something like... [code] float distance = Vector2.Distance(GameObjectWithTag("Missile").transform.position, transform.position); [/code] [editline]19th February 2015[/editline] What would I use to calculate the distance? I can't really use raycasts cause they don't go through objects, so I would use something like.. [code] //This code is on the grenade void OnTriggerEnter2D(Collider2D collider) { float distance = 0; if (collider.tag == "Enemies") { distance = Vector2.Distance(collider.transform.position, transform.position); collider.GetComponent<EnemyController>().TakeDamage(200 / distance); } } [/code] Haven't tested any of this code, I just wrote it here just so I know if this is the right approach.[/QUOTE] In case you haven't figured it out by now, there's a raycast called RaycastAll that doesn't stop when it hits something and gives you the info on all the things it hit. To tell how far away the missile is from the ship I just did exactly what you said. However, that doesn't work when it comes to large hulls where a missile could explode against the hull but be too far away from the origin of the ship to damage it. Funny enough, Freelancer had this exact problem and it made missile weapons unreliable when shooting at capital ships. In those cases it gets tricky. I don't remember if I actually implemented it or not, but I think my idea was to do a raycast from the explosion center to the ship origin and then calculate damage based on how far away the intersect point with the ship's collision mesh was. There are very specific situations where that would give a bad result though, so it might not be the best approach. With the OnTriggerEnter2D, there should be a way to check the specific points at which it made contact, and if you can then do the distance calculation between the explosion from that point and the explosion center. It's been a while since I write that stuff so sorry I can't give any better advice.
[QUOTE=Why485;47178696]In case you haven't figured it out by now, there's a raycast called RaycastAll that doesn't stop when it hits something and gives you the info on all the things it hit. To tell how far away the missile is from the ship I just did exactly what you said. However, that doesn't work when it comes to large hulls where a missile could explode against the hull but be too far away from the origin of the ship to damage it. Funny enough, Freelancer had this exact problem and it made missile weapons unreliable when shooting at capital ships. In those cases it gets tricky. I don't remember if I actually implemented it or not, but I think my idea was to do a raycast from the explosion center to the ship origin and then calculate damage based on how far away the intersect point with the ship's collision mesh was. There are very specific situations where that would give a bad result though, so it might not be the best approach. With the OnTriggerEnter2D, there should be a way to check the specific points at which it made contact, and if you can then do the distance calculation between the explosion from that point and the explosion center. It's been a while since I write that stuff so sorry I can't give any better advice.[/QUOTE] I ended up doing the Trigger thing and it works correctly.
[QUOTE=cam64DD;47177640][t]http://i.imgur.com/zPoejI3.png[/t] I love team fortress. I really do. So I decided to start a side project and try to recreate it while fixing/changing some things. And before anyone asks, yes, that is my poor rendition of ctf_orange![/QUOTE] Oh I'm doing something similar. It's just 2D, top-down, and about interdimensional vehicular combat. Vehicular on two layers - it's all about cars and tanks and the levels themselves are gigantic trains and planes (well not yet but on it). Oh and the spawns... Average-sized planes and trains :v: But yeah. Other than that, pure TF2 ripoff. Some of the same classes and stuff. You can "rocketjump" with the tank when you hold shift etc.
Does anyone know how i can get Unity3D to run in batch mode without having pro?
[QUOTE=riekelt;47183974]Does anyone know how i can get Unity3D to run in batch mode without having pro?[/QUOTE] You can't.
[QUOTE=KillaMaaki;47184013]You can't.[/QUOTE] So how do i go about making a dedicated server without having to 1500/75 per month?
[QUOTE=riekelt;47184275]So how do i go about making a dedicated server without having to 1500/75 per month?[/QUOTE] I guess you don't, well you have 30days trial you can maybe use that.
[QUOTE=Exho;47177914]Is that cell shading?[/QUOTE] The lighting on the hands and wall doesn't seem very ramped. It's just an outline, like Borderlands
Sorry, you need to Log In to post a reply to this thread.