• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=AtomiCal;46047420]We can't give you an answer. Pick what you feel is right I guess. Maybe pick a smaller project? Are you working on it by yourself?[/QUOTE] I work on it with a friens(he is making the designs) I pretty much make everything else. I pretty much finished all the coding and now I need the map done, which I hate doing.
after a long day of coding and problems, this is what i've resorted to when finding shit that's broken: [t]http://i.imgur.com/tCUsWE1.png[/t]
[QUOTE=Gamerman12;46053932]after a long day of coding and problems, this is what i've resorted to when finding shit that's broken: [t]http://i.imgur.com/tCUsWE1.png[/t][/QUOTE] What are you talking about? That's standard procedure!
[QUOTE=Eric95;46051563]Does Unity support xinput properly yet?[/QUOTE] You need Unity Pro, but I have a ControllerInput wrapper for XInput. If you want it, I'll share it? Just need to document it a bit.
New version of Visual Studio Tools for Unity is out, and it finally fixed those annoying debugging hangs. Changelog can be found here: [URL]http://unityvs.com/documentation/changelog/#1.9.1[/URL]
[B]Edit: [/B]Fuck it, just reverted to how I did it before, it's not nice, but it works.
Don't you have to pass an IEnumerable as a parameter? Just generally I mean, so you can do all the operations on that variable.
[QUOTE=Gamerman12;46053932]after a long day of coding and problems, this is what i've resorted to when finding shit that's broken: [t]http://i.imgur.com/tCUsWE1.png[/t][/QUOTE] I usually do this because I will write a method and nothing inside it will be called [sp]only to realize I didn't invoke the method anywhere. [/sp]:v:
My standard procedure for stuff like that goes something like: [code] Debug.Log( "WTF" ); SomeMethod(); void SomeMethod() { Debug.Log( "WTF!?" ); } [/code]
[QUOTE=Gamerman12;46053932]after a long day of coding and problems, this is what i've resorted to when finding shit that's broken: [t]http://i.imgur.com/tCUsWE1.png[/t][/QUOTE] I just found soul mate. I usually use 'fuck', 'fuck you', 'it works doesnt it retard', 'fuck you twice', etc :D
Could someone give me the run down of aiming with characters? Like a third person player, who can play running animations, but also aim his torso/weapon around. I've heard that you can use animation blending, but I'm not quite sure how I'd do it.
After figuring out how to do this myself, here's how you accomplish it in Mecanim. First, you need aiming animations for each Up/Down/Left/Right directions you want the character to aim in. This is very important - for each of these animations it [B]must[/B] be a "sweep" animation - that is, the first frame begins with the character aiming forwards, and the last frame ends on the character aiming in the given direction (up, for instance). And then, on import, you must then uncheck "loop pose" so that the animation will clamp at the end when playing at runtime. Now, in your animation tree, you create a new layer for aiming, set the layer blending to Additive, and then create a blend tree in this layer which blends between each of the aim animations. While you're previewing the animation in the Mecanim inspector, it will look strange (the aim animation will loop, causing the character to sweep from origin to aim direction, then snap back to origin and sweep to aim direction, etc etc over and over). This is fine, ignore it. Now, at runtime, just change the parameters you used in the blend tree from script and viola, your character can aim up/down/left/right on top of whatever animations they are already playing (since the aiming is added on top of them).
[QUOTE=Eric95;46051563]Does Unity support xinput properly yet?[/QUOTE] One of my friends wrote an input system that i [I]think[/I] uses xinput but I don't remember. He's got a free download for it [URL="http://www.roadturtlegames.com/?page_id=57"]here.[/URL] Also while I'm plugging stuff I just recently put up and object pooling system that I wrote. You can get it for free [URL="http://www.roadturtlegames.com/?page_id=114"]here.[/URL]
I see, well I'm actually decompiling Source models. The CSS Pheonix model to be exact. I've imported it correctly with animations and all, but the *aiming* animations are along the lines of. [code]idle_ak_aim_down_center idle_ak_aim_down_left idle_ak_aim_down_right idle_ak_aim_mid_center idle_ak_aim_mid_left idle_ak_aim_mid_right idle_ak_aim_up_center idle_ak_aim_up_left idle_ak_aim_up_right[/code] Just simple 2 frame animations of each position, but no centered first frame, as there's already [B]mid_center[/B] and etc. Could this still work?
[QUOTE=sarge997;46057371]I see, well I'm actually decompiling Source models. The CSS Pheonix model to be exact. I've imported it correctly with animations and all, but the *aiming* animations are along the lines of. [code]idle_ak_aim_down_center idle_ak_aim_down_left idle_ak_aim_down_right idle_ak_aim_mid_center idle_ak_aim_mid_left idle_ak_aim_mid_right idle_ak_aim_up_center idle_ak_aim_up_left idle_ak_aim_up_right[/code] Just simple 2 frame animations of each position, but no centered first frame, as there's already [B]mid_center[/B] and etc. Could this still work?[/QUOTE] Source works differently, so each animation can specify [I]any frame of any animation it is relative to[/I] (if I remember correctly). So for example most of those animations probably specify that they are relative to the mid_center animation. This can't be done in Mecanim, unfortunately. So you'd have to modify those animations in order to work.
something went wrong [t]http://i.imgur.com/odc6ke0.png[/t] (that's the player's path)
I'm so lost here right now. So, I'm using bolt and I got authoritative movement working just fine. My current problem now is how to get weapon switching and weapon functionality working. If any of you guys work with bolt, how are you doing these two things?
[QUOTE=cam64DD;46058326]I'm so lost here right now. So, I'm using bolt and I got authoritative movement working just fine. My current problem now is how to get weapon switching and weapon functionality working. If any of you guys work with bolt, how are you doing these two things?[/QUOTE] Dunno about Bolt (sorry for potential stupid comment), but usually you send command "weapon switch" from client , and server authorizes it and sends command back, and if it wasn't authotized, client sets the weapon to previous weapon?
[QUOTE=Fourier;46058394]Dunno about Bolt (sorry for potential stupid comment), but usually you send command "weapon switch" from client , and server authorizes it and sends command back, and if it wasn't authotized, client sets the weapon to previous weapon?[/QUOTE] There's a much better way to do that in Bolt, actually. Basically, client sends the weapon they [I]want[/I] to equip in the player input command. The server and client when executing that command will then attempt to switch to that weapon. The server will send back the resulting actively equipped weapon in the state response. Whenever the client switches weapons, it also stores the network-synced time (in Bolt, the frame) on which it switched weapons. When it receives a reset state command from the server, it compares the network frame of the received state correction versus the stored network frame, and if received frame >= stored frame it will switch to the "correct" weapon. Same for ammo, actually. Hopefully I can get my FPS kit out ASAP, as it will implement all of this.
[QUOTE=KillaMaaki;46058431]There's a much better way to do that in Bolt, actually. Basically, client sends the weapon they [I]want[/I] to equip in the player input command. The server and client when executing that command will then attempt to switch to that weapon. The server will send back the resulting actively equipped weapon in the state response. Whenever the client switches weapons, it also stores the network-synced time (in Bolt, the frame) on which it switched weapons. When it receives a reset state command from the server, it compares the network frame of the received state correction versus the stored network frame, and if received frame >= stored frame it will switch to the "correct" weapon. Same for ammo, actually. Hopefully I can get my FPS kit out ASAP, as it will implement all of this.[/QUOTE] Do you have any estimate on when you might have that ready? Within the next month maybe? It takes care of everything I've wanted to do with my game. Also, can you comment on the modularity of your FPS kit? The rest of my game has been developed completely modular as well and this may be the perfect solution for networking.
[QUOTE=Velocet;46058816]Do you have any estimate on when you might have that ready? Within the next month maybe? It takes care of everything I've wanted to do with my game. Also, can you comment on the modularity of your FPS kit? The rest of my game has been developed completely modular as well and this may be the perfect solution for networking.[/QUOTE] No estimate, sorry. Hoping to get it out soon-ish, however. As far as modularity, it is designed to be very modular although it would probably be easier to build your game around the kit rather than trying to integrate the kit into an existing game.
[QUOTE=KillaMaaki;46058431]There's a much better way to do that in Bolt, actually. Basically, client sends the weapon they [I]want[/I] to equip in the player input command. The server and client when executing that command will then attempt to switch to that weapon. The server will send back the resulting actively equipped weapon in the state response. Whenever the client switches weapons, it also stores the network-synced time (in Bolt, the frame) on which it switched weapons. When it receives a reset state command from the server, it compares the network frame of the received state correction versus the stored network frame, and if received frame >= stored frame it will switch to the "correct" weapon. Same for ammo, actually. Hopefully I can get my FPS kit out ASAP, as it will implement all of this.[/QUOTE] I see. So from client-side viewpoint, client weapon switch is instant, sends signal to server, and then it gets signal back with actual weapon equipped?
[QUOTE=Fourier;46059248]I see. So from client-side viewpoint, client weapon switch is instant, sends signal to server, and then it gets signal back with actual weapon equipped?[/QUOTE] Yep, and the network frame comparison is used to ensure that there's no "jitter" due to network latency, so from the client's point of view everything happens instantly with (hopefully) no visible state corrections (would happen in very rare cases, in the presence of extreme lag, or if the client tries to cheat).
[QUOTE=KillaMaaki;46056751]My standard procedure for stuff like that goes something like: [code] Debug.Log( "WTF" ); SomeMethod(); void SomeMethod() { Debug.Log( "WTF!?" ); } [/code][/QUOTE] Or when you get really desperate [code] void Method() { Debug.Log( "fuck1" ); var a = 1; Debug.Log( "fuck2" ); while ( ++a < 10 ) { Debug.Log( "fuck3-" + a ); } Debug.Log( "fuck4" ); OtherMethod(); Debug.Log( "fuck5" ); if ( global != otherGlobal ) { AnotherThing(); Debug.Log( "fuck6" ); } else { LastThing(); Debug.Log( "fuck7" ); } Debug.Log( "fuck8" ); } [/code] [editline]23rd September 2014[/editline] BTW this is procedure is called 'debugging the fuck out of your code'
So I'm having a lot of trouble with this wallrun code: [t]http://i.imgur.com/X8jVml4.png[/t] (the rays represent the normals/direction of the wallrun, i.e. we're hitting a wall) What's happening is when I walljump, somehow my ray is getting hit or something where it shouldn't be. I'm using a character controller, so it might be colliding with the that? But I don't know if rays can collide with themselves. Here's the code that checks for a wall (no left side yet) and points the next moveDirection in the direction of the wall: [code] bool CheckWallRun() { Vector3 footPos = transform.position; float pushDistance = 2f; wallRight = Physics.Raycast (footPos, transform.right, out wallHit, pushDistance); // Draw ray left/right to catch if we're touching a wall float colliderNormalRight; colliderNormalRight = Vector3.Dot (transform.right * pushDistance,wallHit.normal); if (wallRight && wallRunTimer < wallRunTimeLimit && nextWallJump <= 0f) { IsWallRunning = true; Vector3 wallNormal = wallHit.normal; if(colliderNormalRight > 0) // check if wall is on the left { wallRunDirection = Quaternion.AngleAxis(-89,Vector3.up) * wallNormal; wallJumpDirection = Quaternion.AngleAxis(-15,Vector3.up) * wallNormal; } else if (colliderNormalRight < 0) // else it's on the right { wallRunDirection = Quaternion.AngleAxis(89,Vector3.up) * wallNormal; wallJumpDirection = Quaternion.AngleAxis(15,Vector3.up) * wallNormal; } else { return false; } //Debug.DrawRay(transform.position, transform.right * pushDistance, Color.red, 100); Debug.DrawRay(wallHit.point, wallNormal * pushDistance, Color.green, 100); Debug.DrawRay(wallHit.point, wallRunDirection, Color.cyan, 100); return true; } else { IsWallRunning = false; return false; } } [/code] I have no idea if it's something wrong with this code, or the code that calls this bool. Help?? If you need the full code, I can PM it to you, I just don't feel like spreading it publicly just yet.
[QUOTE=Gamerman12;46059720]I have no idea if it's something wrong with this code, or the code that calls this bool. Help?? If you need the full code, I can PM it to you, I just don't feel like spreading it publicly just yet.[/QUOTE] Do your walls have their own layer? If not, try giving them a unique layer then create a mask [code] LayerMask wallsOnly = 1 << LayerMask.NameToLayer( "WhateverYouNamedYourWallLayer" ); [/code] and use that in your Raycast
[QUOTE=foszor;46059874]Do your walls have their own layer? If not, try giving them a unique layer then create a mask [code] LayerMask wallsOnly = 1 << LayerMask.NameToLayer( "WhateverYouNamedYourWallLayer" ); [/code] and use that in your Raycast[/QUOTE] Alright, that saved it. I guess this'll have to do for now (my hope was to make it fully dynamic, so our level deisgn could be subtractive, not additive, in picking what surfaces we could wallrun on)
[QUOTE=Gamerman12;46060454]Alright, that saved it. I guess this'll have to do for now (my hope was to make it fully dynamic, so our level deisgn could be subtractive, not additive, in picking what surfaces we could wallrun on)[/QUOTE] Well you could go the opposite way and ignore the player and other specific layers while casting against everything else.
So I've been going through a beginners tutorial for C# and Unity, and I've been supplementing it with little challenges of my own. For this tutorial, we're creating a player moving at a constant speed, with a queue-based backdrop made up of cubes that recycles once each cube is a set distance behind the player. I thought I'd try and make it more interesting by having each backdrop cube fade out before vanishing, but several hours later and I still can't get the change in alpha to have a visible effect, even though my print() statements show the math is working. Any ideas? The skyline manager instantiates the prefab cube, and the FadeOut script is a component of the prefab cube. [code] using UnityEngine; using System.Collections.Generic; public class SkylineManager : MonoBehaviour { public Transform prefab; public int numberOfObjects; public Vector3 startPosition; public Material prefabmat; private Vector3 nextPosition; private Queue<Transform> objectQueue; private float recycleOffset; private FadeOut fadeOut; void Start () { objectQueue = new Queue<Transform>(numberOfObjects); nextPosition = startPosition; recycleOffset = numberOfObjects/2; for (int i = 0; i < numberOfObjects; i++) { Transform o = (Transform)Instantiate(prefab); o.localPosition = nextPosition; nextPosition.x += o.localScale.x; objectQueue.Enqueue(o); } } void Update () { if (objectQueue.Peek().localPosition.x + recycleOffset < Runner.distanceTraveled) { Transform o = objectQueue.Peek(); fadeOut = o.GetComponent<FadeOut>(); fadeOut.enabled = true; //o.transform.localPosition = nextPosition; //nextPosition.x += o.localScale.x; //objectQueue.Enqueue(o); } } }[/code] [code] using UnityEngine; using System.Collections; public class FadeOut : MonoBehaviour { public Material material; float matA; float mattest; // Use this for initialization public void Start () { enabled = false; //mattest = gameObject.renderer.material.color.a; Material mat = (Material)Instantiate(material); matA = mat.color.a; } void Update() { //matA = Mathf.Max (matA -= 0.05f, 0f); // matA = 255f; // // if (matA == 0f) // { // enabled = false; // } // print (matA); // print (this.enabled); mattest = Mathf.Max (mattest -= 0.05f, 0f); //gameObject.renderer.material.SetColor("_color", Color(1, 2, 3)); if (mattest == 0f) { enabled = false; } print (mattest); print (this.enabled); } } [/code]
[QUOTE=foszor;46059676]Or when you get really desperate [code] void Method() { Debug.Log( "fuck1" ); var a = 1; Debug.Log( "fuck2" ); while ( ++a < 10 ) { Debug.Log( "fuck3-" + a ); } Debug.Log( "fuck4" ); OtherMethod(); Debug.Log( "fuck5" ); if ( global != otherGlobal ) { AnotherThing(); Debug.Log( "fuck6" ); } else { LastThing(); Debug.Log( "fuck7" ); } Debug.Log( "fuck8" ); } [/code] [editline]23rd September 2014[/editline] BTW this is procedure is called 'debugging the fuck out of your code'[/QUOTE] this is far too familiar and i am ashamed
Sorry, you need to Log In to post a reply to this thread.