• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=Asgard;44409419]Wat. Class name is definitely correct.[/QUOTE] Open the file and check the class name.
[QUOTE=Z_guy;44409448]Open the file and check the class name.[/QUOTE] As I said, definitely all correct.
[QUOTE=Asgard;44409483]As I said, definitely all correct.[/QUOTE] Are you sure? Sometimes restarting Unity fixes weird problems. Have you tried that?
Nvm, turns out this version of Unity's .NET doesn't support named params. Ugh.
[QUOTE=Asgard;44409681]Nvm, turns out this version of Unity's .NET doesn't support named params. Ugh.[/QUOTE] Yeah the Mono runtime's age in Unity can be frustrating at times. There are some licensing issues with upgrading it too and I hope it's something they can eventually figure out.
[QUOTE=SteveUK;44414107]Yeah the Mono runtime's age in Unity can be frustrating at times. There are some licensing issues with upgrading it too and I hope it's something they can eventually figure out.[/QUOTE] What version do they use in Unity?
[QUOTE=Richy19;44414185]What version do they use in Unity?[/QUOTE] 2.6
How can I make something float/move 0.1 unit from the ground? Or let me rephrase this, how can I make NPC that can move around? I tried raycasting down the ground and then moving it above a bit by hit position.. [CODE] if (Physics.Raycast(transform.position, Vector3.down, out hit,1f)) { var pos = this.transform.position; pos.y = hit.point.y + 0.12f; transform.position = pos; } [/CODE] But this approach is buggy and it doesn't always work (if NPC is 1 unit above ground, it just stays floating in the air)
[QUOTE=HeatPipe;44418287]But this approach is buggy and it doesn't always work (if NPC is 1 unit above ground, it just stays floating in the air)[/QUOTE] That's because your raycast has a length of one unit. Use Mathf.Infinity as it is by default.
[QUOTE=DarKSunrise;44418410]That's because your raycast has a length of one unit. Use Mathf.Infinity as it is by default.[/QUOTE] I don't want it to be infinity. I need to simulate gravity of some kind hmm..
[QUOTE=HeatPipe;44418431]I don't want it to be infinity. I need to simulate gravity of some kind hmm..[/QUOTE] You can check if you have collision with the ground, and then move up. Or just use collision.
[QUOTE=Asgard;44418452]You can check if you have collision with the ground, and then move up. Or just use collision.[/QUOTE] Heh it is kinda problematic, when something collides with NPC, NPC falls down (trips), and then later, when this rigid body sleeps, it starts to recover and starts to walk again to whatever he was going to do anyway. But thanks for idea.. I can always use second body for just ground checking :)
[QUOTE=HeatPipe;44418505]Heh it is kinda problematic, when something collides with NPC, NPC falls down (trips), and then later, when this rigid body sleeps, it starts to recover and starts to walk again to whatever he was going to do anyway. But thanks for idea.. I can always use second body for just ground checking :)[/QUOTE]Sounds like your npc does not have any constraint on the rigidbody for the rotation. Try constrain all of the rotation in the rigidbody component?
-old post snip-
[QUOTE=Skibur;44419178]Sounds like your npc does not have any constraint on the rigidbody for the rotation. Try constrain all of the rotation in the rigidbody component?[/QUOTE] Sorry for miswritten post... The NPC tripping is desired behaviour, it needs to trip when it touches anything or if anything touches it. Problem is when it moves around and it doesn't always hit the ground... Well I will try to fix it somehow hehe, there is lots of time infront of me :)
So, as far as networking inputs, is there a Source Like way to gather inputs as raw data instead of strings?
My next job as a lead programmer is to recreate something what Halo CE has done. [T]http://i.imgur.com/kxbKv5X.png[/t][T]http://i.imgur.com/JJLj9kp.png[/T]
[QUOTE=CrashLemon;44423996]So, as far as networking inputs, is there a Source Like way to gather inputs as raw data instead of strings?[/QUOTE] You could try Sockets? Receive: [url]http://msdn.microsoft.com/en-us/library/8s4y8aff(v=vs.110).aspx[/url] Send: [url]http://msdn.microsoft.com/en-us/library/w93yy28a(v=vs.110).aspx[/url]
Added power-ups, pathfinding (for spawning powerups and detecting unconnected tiles) and an UI. [vid]https://dl.dropboxusercontent.com/u/22104913/Tiles2.mp4[/vid] Also, if anyone remembers that game with the ball and the level editor that I posted a long time ago, I finally released it. [url]http://www.amazon.com/gp/product/B00J1195SW[/url] [img]https://dl.dropboxusercontent.com/u/22104913/promosmall.png[/img]
Okay I need some help here. I had to reinstall Unity, and when I did my Razer Hydras lost some functionality in my project. When I run the project I can move the Hydras fine, but button presses don't do anything. I opened Sixenses test level for input and in that, input was working fine. I'm at a loss as to what happened to my project
Is it possible for an object to know if it's collider is being hit by a ray? I haven't really been able to find anything on it. In the little laser bouncing game I'm working on, I have prefab that splits the laser into three separate beams (marked in red below). It has four child objects with the laser script, one going in each of the four directions. I have it scripted so that when a laser hits it, it turns on all of the child lasers except the one that would rebound on the original laser. [t]https://dl.dropboxusercontent.com/u/48795891/problem_img_1.jpg[/t] Currently, in order to tell whether a laser hits it, I have to use the laser script to turn the splitter's "on" variable to "true". And the only way I could think of to turn it off when the laser stops hitting it is to turn "on" to false at the end of the splitter's update method. This caused the problem that when a reflected laser hit it, it would turn on all of the child lasers on including the one that rebounds on the original laser. I was able to circumvent it by making the lasers check to see if the splitter is off before it before it did anything with it. That fixed the problem...mostly My problem now is that for some reason, there's one little spot on the splitter where if you rotate the mirror circled in red below to where the laser bouncing off would hit the splitter, it'll still turn on the child laser rebounding on the original laser (in the picture it becomes a little darker). [t]https://dl.dropboxusercontent.com/u/48795891/problem_img_2.jpg[/t] Edit: Holy shit, I can't believe I just said the word "laser" 15 times in a singe post.
[QUOTE=HeatPipe;44427826]You could try Sockets? Receive: [url]http://msdn.microsoft.com/en-us/library/8s4y8aff(v=vs.110).aspx[/url] Send: [url]http://msdn.microsoft.com/en-us/library/w93yy28a(v=vs.110).aspx[/url][/QUOTE] Sorry my question wasn't clear. I'm using uLink as network library and what I'm wondering is if there's way to get "buttons" (the default unity key bind system) without using their string names or do I have to make my own bindings?
[QUOTE=Jacen;44433763]LASERS[/QUOTE] The simplest answer is: - Fix how you are handling the "on" variable - tell an object when something starts and stops lasering it. - If an object is already "on" don't turn it on again I would (possibly): - Send a message or call a function instead of directly setting the on variable (when the lasering starts and stops) - Have the emitting laser object handle all segments of its beam
[QUOTE=CrashLemon;44433782]Sorry my question wasn't clear. I'm using uLink as network library and what I'm wondering is if there's way to get "buttons" (the default unity key bind system) without using their string names or do I have to make my own bindings?[/QUOTE] You'll have to clarify. Do you want an alternate input system, that is some way you can change the binding of a specific button, key, or axis, or are you talking about sending input state over the network? In the former case, you can do it for buttons but not axes (like joysticks). The best solution I've found so far is cInput - it lets you use it like Unity's own Input, except you can re-bind input axes and buttons at runtime. In the latter case, the best answer is "it depends". In my game, I'm trying to employ Source-ish networking concepts. When I send input state to the server, this is what I'm sending: Vector2 MoveDirection - the direction of input Vector3 LookDirection - the direction the unit is looking in byte ButtonMask - a bitmask of button states. Each button is one bit - either on or off (pressed or released). This contains up to 8 buttons - in my game will store Jump, Crouch, Sprint, Fire, and AltFire (with three buttons to spare if I need them). But this is a bit game specific.
Fixed up my UI and moved to a Dynamic UI system which changes depending on the unit block that is selected. [img]http://i.imgur.com/GvbLdUR.gif[/img]
[QUOTE=KillaMaaki;44437250]You'll have to clarify. Do you want an alternate input system, that is some way you can change the binding of a specific button, key, or axis, or are you talking about sending input state over the network? In the former case, you can do it for buttons but not axes (like joysticks). The best solution I've found so far is cInput - it lets you use it like Unity's own Input, except you can re-bind input axes and buttons at runtime. In the latter case, the best answer is "it depends". In my game, I'm trying to employ Source-ish networking concepts. When I send input state to the server, this is what I'm sending: Vector2 MoveDirection - the direction of input Vector3 LookDirection - the direction the unit is looking in byte ButtonMask - a bitmask of button states. Each button is one bit - either on or off (pressed or released). This contains up to 8 buttons - in my game will store Jump, Crouch, Sprint, Fire, and AltFire (with three buttons to spare if I need them). But this is a bit game specific.[/QUOTE] Thanks latter case is exactly what I was looking for. I was setting up a bitmask for button states but I wasn't sure if there was a way to get a bit value from unity's button system instead of the strings they use. Did you set a table of bindings (bits) associated with the keys and going through each update to check if a button was pressed?
[QUOTE=CrashLemon;44440140]Thanks latter case is exactly what I was looking for. I was setting up a bitmask for button states but I wasn't sure if there was a way to get a bit value from unity's button system instead of the strings they use. Did you set a table of bindings (bits) associated with the keys and going through each update to check if a button was pressed?[/QUOTE] Well, my client sends input to the server every fixed update via RPC. I have a wrapper class around my button bitmask, so my input gathering code looks like this: [code] InputState inputState = new InputState(); if( Input.GetButton( "Jump" ) ) inputState.SetButton( 0 ); if( Input.GetButton( "Fire" ) ) inputState.SetButton( 1 ); // etc [/code] So prior to passing input to the server, I check each button via Input.GetButton[xxx] and set the appropriate bit of the bitmask accordingly. Then I send the bitmask to the server (currently one byte, but I could easily extend that to a short or even a full int if I needed more buttons), which parses each bit to determine which buttons are pressed. Here's what my input state code does in a nutshell: [code] public struct InputState { public int ButtonMask; public void SetButton( int bitIndex ) { this.ButtonMask |= ( 1 << bitIndex ); } public void UnsetButton( int index ) { int mask = ( 1 << index ); this.ButtonMask &= ( ~mask ); } public bool GetButton( int index ) { return ( this.ButtonMask & ( 1 << index ) ) != 0; } } [/code] On the server-side, after receiving input from the player, decodes it like this: [code] [RPC] void Request_Move( byte buttons ) { InputState inputState = new InputState(); inputState.ButtonMask = buttons; bool jump = inputState.GetButton( 0 ); bool fire = inputState.GetButton( 1 ); // etc. } [/code] Does all of that make sense?
Messed around with normal maps with Unity's SpriteRenderer but I get these [URL="https://dl.dropboxusercontent.com/u/95914614/Promethium/Build.html"]weird artifacts[/URL] from overlapping lights. [t]http://puu.sh/7VORx/8e97253ecb.jpg[/t]
[QUOTE=z-machine;44451622]Messed around with normal maps with Unity's SpriteRenderer but I get these [URL="https://dl.dropboxusercontent.com/u/95914614/Promethium/Build.html"]weird artifacts[/URL] from overlapping lights. [t]http://puu.sh/7VORx/8e97253ecb.jpg[/t][/QUOTE] Not what you wanted but it looks like you used a tool to build your normal maps. It's very obvious and doesn't give the right effect, I suggest doing it by hand.
[QUOTE=Perl;44452775]Not what you wanted but it looks like you used a tool to build your normal maps. It's very obvious and doesn't give the right effect, I suggest doing it by hand.[/QUOTE] The extent of the normal maps currently is just the texture thrown into greyscale and then I fiddled with the levels in gimp and applied some gradients. It leaves a lot to be desired but I'm not really an artist. [t]http://puu.sh/7W5AZ/0c8255acb3.png[/t] edit: It's actually a heightmap and unity is generating the normals for me.
Sorry, you need to Log In to post a reply to this thread.