• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=amgoz1;44841419]Deleting or disabling the directional light is the only thing that affects the shadow. If I create a blank scene with a default directional light and a box the problem persists.[/QUOTE] That can't be right at all. I've never seen that, not one version of Unity since 2.6 all the way up to now. WTF?
[QUOTE=KillaMaaki;44841460]That can't be right at all. I've never seen that, not one version of Unity since 2.6 all the way up to now. WTF?[/QUOTE] Been using Unity for quite a while and this is the first time I'm having any kind of issue with the editor. Going to try reinstalling.
Try a blank project perhaps?
Hello, does there exists faster version of LineRenderer? Just wondering
Can somebody help me figure out some issues with my Physics spell? I'm not sure why this is happening all of a sudden but its just become really apparent. When I pick up an object and its in the held state, If I press the button again it should release it if it isn't being charged, and if it is charged it releases it with a force. However when I try it now, when I pick up the object, it just keeps playing the release without charge audio when I press the button, and when I charge and shoot it, it gets caught straight away, like the cooldown isn't working. Mind having a look? [url]http://pastebin.com/6nJYaUFY[/url]
Something broke when I built my game. Any ideas? What it should look like: [t]https://dl.dropboxusercontent.com/u/13781308/ShareX/2014-05/2014-05-19_11-11-10.png[/t] How it actually looks: [t]https://dl.dropboxusercontent.com/u/13781308/ShareX/2014-05/2014-05-19_11-09-11.png[/t] [editline]19th May 2014[/editline] [t]https://dl.dropboxusercontent.com/u/13781308/ShareX/2014-05/2014-05-19_11-24-29.png[/t] with the script debug window thing [editline]19th May 2014[/editline] output_log.txt doesn't say anything problematic
Looks to me like all of your textures have been obliterated o.O
Tried it on my desktop (win7, non-integrated graphics) and it works fine. [editline]e[/editline] Maybe I need to update my drivers? [editline]e[/editline] nope, what the fuck
So I just figured how to do rotation between two vectors and center point (It is simple as fuck) How come this isn't documented anywhere I don't know. Basically, you define your center where you want to do rotation, and two vectors (unit vectors for sphere), which form a ring similiar to unit circle. Then you do the fucking magic! [code] var β = [radians here]; var radius = [radius here]; var vector1 = new Vector(1,0,0); //X axis var vector2 = new Vector(0,1,0); //Y axis var pos = center + ((vector1 * (float)Math.Cos(β)) + (vector2 * (float)Math.Sin(β)) ) * radius; [/code] Boom, rotating around center on circle defined by two vectors.
[QUOTE=HeatPipe;44850604]So I just figured how to do rotation between two vectors and center point (It is simple as fuck) How come this isn't documented anywhere I don't know. Basically, you define your center where you want to do rotation, and two vectors (unit vectors for sphere), which form a ring similiar to unit circle. Then you do the fucking magic! [code] var β = [radians here]; var radius = [radius here]; var vector1 = new Vector(1,0,0); //X axis var vector2 = new Vector(0,1,0); //Y axis var pos = center + ((vector1 * (float)Math.Cos(β)) + (vector2 * (float)Math.Sin(β)) ) * radius; [/code] Boom, rotating around center on circle defined by two vectors.[/QUOTE] ..why do you have two different vectors for the x and y axis...
[QUOTE=Pelf;44849736]Something broke when I built my game. Any ideas? What it should look like: - How it actually looks: [t]https://dl.dropboxusercontent.com/u/13781308/ShareX/2014-05/2014-05-19_11-09-11.png[/t] [editline]19th May 2014[/editline] - with the script debug window thing [editline]19th May 2014[/editline] output_log.txt doesn't say anything problematic[/QUOTE] I changed the scene order so that it loads the first actual level first, instead of the setup/main menu scenes. I quit to the main menu and it was partially broken. I reloaded the game scene and quite back to the main menu and it was working. -vid snip- what [editline]e[/editline] nevermind, it wasn't working, the main menu was still missing the smaller moon. :suicide: [editline]e[/editline] So I made a shortcut for my build and made it launch with [i] -force-d3d11[/i] and it works.
[QUOTE=HeatPipe;44850604]So I just figured how to do rotation between two vectors and center point (It is simple as fuck) How come this isn't documented anywhere I don't know. Basically, you define your center where you want to do rotation, and two vectors (unit vectors for sphere), which form a ring similiar to unit circle. Then you do the fucking magic! [code] var β = [radians here]; var radius = [radius here]; var vector1 = new Vector(1,0,0); //X axis var vector2 = new Vector(0,1,0); //Y axis var pos = center + ((vector1 * (float)Math.Cos(β)) + (vector2 * (float)Math.Sin(β)) ) * radius; [/code] Boom, rotating around center on circle defined by two vectors.[/QUOTE] You could replace 'vector1' and 'vector2' with Vector3.right and Vector3.up :)
[QUOTE=FalconKrunch;44851191]..why do you have two different vectors for the x and y axis...[/QUOTE] It is just example. You can define your OWN axises the way you want, and vectors don't have to be normalised so you can get eclipse or some weird rotation on :) [editline]19th May 2014[/editline] [QUOTE=KillaMaaki;44851476]You could replace 'vector1' and 'vector2' with Vector3.right and Vector3.up :)[/QUOTE] True, true :)
Did you guys see the new Unity blog post? [video=youtube;W2MLGm6Zgkc]http://www.youtube.com/watch?v=W2MLGm6Zgkc[/video] [URL]http://blogs.unity3d.com/2014/05/19/teleporter-demo/[/URL]
I did. SO cool! Then of course I made the mistake of looking at the Youtube comments...
So fucking great, Unity just crashed and it destroyed my 300 line TeslaCoil.cs file, and I commited yesterday, but it doesn't look like I included TeslaCoil.cs file, so if this isn't great I don't know what is it.. meh i feel so sad now why does this shit have to happen :( But now I have enabled File History, every 20 minutes backup, 1 month versions. Ok script rewritten, still not good as original, what the hell I am going to sleep
[QUOTE=HeatPipe;44861203] But now I have enabled File History, every 20 minutes backup, 1 month versions. Ok script rewritten, still not good as original, what the hell I am going to sleep[/QUOTE] Even 10 minutes it's too much time between you're on fire and start writting then...Crash
[QUOTE=gonzalolog;44865643]Even 10 minutes it's too much time between you're on fire and start writting then...Crash[/QUOTE] Kind of agree :D Here, I changed it to 10 minutes because it really doesn't cost me nothing. [editline]21st May 2014[/editline] Hey, what does 'physicaly based' rendering means?
[QUOTE=HeatPipe;44865910] Hey, what does 'physicaly based' rendering means?[/QUOTE] Physically based rendering is a somewhat new shader technique with a strong focus on adhering to (simplified) physics properties. It can be summed up like this: "you can never emit more energy than you receive". And also, "in real life, everything is shiny to some degree". There's a lot of implications of that, but it boils down to this: Instead of specular amount/exponent, you instead have just a "roughness" value. And you never have zero specular - if you take a piece of cardboard for instance, and view it edge-on with a light, it will be a little bit shiny (fresnel effect) Very smooth surfaces have intense, sharp highlights. Rough surfaces have diffused, blurry highlights. There's other bits involved in there too (like box-projected reflections and such) - but the end result is that it's much easier to emulate real world materials, with a combination of diffuse color and surface roughness value. Actually, I'll give a real world example. Let's say you want to model a silver object. How would you do it? Grey/silvery diffuse map plus cubemap reflection? Not in PBR. Instead, you give it a [I]pure black[/I] diffuse color map, and give it a reflection map + tweak surface roughness to taste (higher roughness for a brushed metal look, lower roughness for more of a mirror-like finish) [url]http://www.marmoset.co/toolbag/learn/pbr-practice[/url] It's been used in CryEngine for a while, and adopted by plenty of other games over time.
[QUOTE=KillaMaaki;44865970]Physically based rendering is a somewhat new shader technique with a strong focus on adhering to (simplified) physics properties. It can be summed up like this: "you can never emit more energy than you receive". And also, "in real life, everything is shiny to some degree". There's a lot of implications of that, but it boils down to this: Instead of specular amount/exponent, you instead have just a "roughness" value. And you never have zero specular - if you take a piece of cardboard for instance, and view it edge-on with a light, it will be a little bit shiny (fresnel effect) Very smooth surfaces have intense, sharp highlights. Rough surfaces have diffused, blurry highlights. There's other bits involved in there too (like box-projected reflections and such) - but the end result is that it's much easier to emulate real world materials, with a combination of diffuse color and surface roughness value. Actually, I'll give a real world example. Let's say you want to model a silver object. How would you do it? Grey/silvery diffuse map plus cubemap reflection? Not in PBR. Instead, you give it a [I]pure black[/I] diffuse color map, and give it a reflection map + tweak surface roughness to taste (higher roughness for a brushed metal look, lower roughness for more of a mirror-like finish) [url]http://www.marmoset.co/toolbag/learn/pbr-practice[/url] It's been used in CryEngine for a while, and adopted by plenty of other games over time.[/QUOTE] That is sick, actually looks easier to create fine content :D
If you want to get used to the "PBR" way of content creation, there's already Lux (a free open-source PBR framework for Unity). But, I'm really looking forward to the built-in shaders in Unity 5.
[QUOTE=HeatPipe;44861203]So fucking great, Unity just crashed and it destroyed my 300 line TeslaCoil.cs file, and I commited yesterday, but it doesn't look like I included TeslaCoil.cs file, so if this isn't great I don't know what is it.. meh i feel so sad now why does this shit have to happen :( But now I have enabled File History, every 20 minutes backup, 1 month versions. Ok script rewritten, still not good as original, what the hell I am going to sleep[/QUOTE] Yeah I lost about 8-10 hours of coding over a week ago, still haven't returned back to that project yet.
Version control, use it people!
I'm re-doing some code and I've ran into a bit of a problem. This code is supposed to rotate a mirror clock-wise along the Y axis by 90° over an arbitrary amount of time. The problem is that the mirror stops rotating a few degrees over 90° instead of at 90. I honestly don't know what the problem is. [code] float rotationAmount = 90f; //How much the object should rotate in total float timeAmount = .5f; //How much time it takes to rotate, in seconds. IEnumerator Rotate() { rotate = true; float angle = 0f; while(rotate) { if (angle < rotationAmount) { transform.rotation = Quaternion.AngleAxis(transform.rotation.eulerAngles.y + ((rotationAmount / timeAmount) * Time.deltaTime), Vector3.up); angle += ((rotationAmount / timeAmount) * Time.deltaTime); } else { angle = 0; rotate = false; } yield return null; } }[/code]
[QUOTE=Jacen;44873162]I'm re-doing some code and I've ran into a bit of a problem. This code is supposed to rotate a mirror clock-wise along the Y axis by 90° over an arbitrary amount of time. The problem is that the mirror stops rotating a few degrees over 90° instead of at 90. I honestly don't know what the problem is. [code] float rotationAmount = 90f; //How much the object should rotate in total float timeAmount = .5f; //How much time it takes to rotate, in seconds. IEnumerator Rotate() { rotate = true; float angle = 0f; while(rotate) { if (angle < rotationAmount) { transform.rotation = Quaternion.AngleAxis(transform.rotation.eulerAngles.y + ((rotationAmount / timeAmount) * Time.deltaTime), Vector3.up); angle += ((rotationAmount / timeAmount) * Time.deltaTime); } else { angle = 0; rotate = false; } yield return null; } }[/code][/QUOTE] You're not clamping angle to 90. You should do that.
[QUOTE=KillaMaaki;44873212]You're not clamping angle to 90. You should do that.[/QUOTE] Thank you, after a couple changes it works perfectly. Somehow I always forget that clamping exists.
Anyone know how to apply a force to a character controller? I'm trying to add a simple melee knock back type force to an NPC/AI which uses a character controller. Some help would be great.
Character controller doesn't have a concept of "force" or "acceleration". That's what makes it good for characters- it gives you full control over the movement of the character. You could keep track of the character's velocity, and when you want to apply a knockback you add some vector to the character's current velocity.
Hmm, I see. Care to give me a simple example? Here's my shitty work-in-progress melee code. It worked perfectly for rigidbodies, but as I said above, I've changed them over to Character controllers. So I have more control, and because A* uses them. [code]void OnTriggerEnter(Collider other) { Vector3 dir = other.transform.position - transform.position; dir.y = 0; if (other.rigidbody) { if(swinging) { other.rigidbody.AddForce (dir.normalized * force); } } if (other.gameObject.tag == "Enemy") { var aiHealth = other.gameObject.GetComponent<ZombieDeathScript>(); if(swinging) { aiHealth.health -= damage; audio.clip = sounds[Random.Range(0,sounds.Length)]; audio.Play(); } } } [/code]
The code which moves the character (CharacterController.Move) should be keeping track of a velocity vector - used for something like CharacterController.Move( velocity * Time.deltaTime ) Then it could have an AddForce function which does: this.velocity += forceVector;
Sorry, you need to Log In to post a reply to this thread.