• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=Fourier;47040353]Here. Btw this one is in layer 1 right, since 0 is base layer, correct? [t]http://i.imgur.com/NTYNr8u.png[/t] Also tried your suggestions, no luck whatsoever.[/QUOTE] If it appears as "Steer Left" in the animator then you have to write exactly that in code [code]animator.Play("Base.Steer Left", 0, formula);[/code] I think I could be completely wrong, I'm not a programmer and I'm using some kind of namehash technique for my animation that I wrote ages ago and can't remember exactly how it works
[QUOTE=The Rizzler;47040583]If it appears as "Steer Left" in the animator then you have to write exactly that in code [code]animator.Play("Base.Steer Left", 0, formula);[/code] I think I could be completely wrong, I'm not a programmer and I'm using some kind of namehash technique for my animation that I wrote ages ago and can't remember exactly how it works[/QUOTE] Steer Left (orange box) is state, top left are layers. NEVERMIND! Looks like Layers are broken somehow.. I found another way to do this shit (blend trees).
[QUOTE=TheMasterLurk;47029971][t]http://puu.sh/fahGx/455cab97ae.png[/t] I love Awesomium. My game is almost complete, I'm having a little troubles trying to deal with the inventorys UI right now ( I'm using a hacky JSON approach to send it to Awesomiums WebUI ), everything right now is pretty much stuck together with duck tape.[/QUOTE] How's awesomium in unity now? Last time I used it, it would crash the editor or cause weird glitches requiring editor restart.
[QUOTE=Fourier;47040796]Steer Left (orange box) is state, top left are layers.[/QUOTE] Oh yeahhh, now I see that It would have help if I actually looked up Animator.Play wouldn't it, how about [code]animator.Play("Steer Left", -1, formula);[/code] if the layer is 0 then that's Base right? So -1 is the layer under that? Try that if you still have 0 as the layer parameter, I don't know if -1 is right since the docs don't go into much detail about what that parameter actually refers to [QUOTE=Fourier;47040796]NEVERMIND! Looks like Layers are broken somehow.. I found another way to do this shit (blend trees).[/QUOTE] Oh ok haha yeah my player animator is a [URL="http://i.gyazo.com/c5e732d9a3701f4d1812682d147ca6dd.png"]mess[/URL] There's some blendtrees and shit in there but I think I need to go over my methods to make something cleaner to look at haha At least it works though right
[QUOTE=itisjuly;47040845]How's awesomium in unity now? Last time I used it, it would crash the editor or cause weird glitches requiring editor restart.[/QUOTE] Its still horrible, you have to disable all the HTML elements in the editor if you are testing the game real time, else it crashes the editor. I'm pretty sure they've actually pulled the Unity version now from their site, you can now only get it through the archives.
[QUOTE=Noi;47043139]I find unity documentation confusing and unhelpful, any links to good docs?[/QUOTE] The documentation is great. Did you ever use some other projects? What exactly is not helpful? What do you need help with? A documentation is there to provide a starting point, you're still the programmer so you still have to come up with code and stuff yourself.
I wish unity doc would explain how some of the stuff works internally. But besides that it's one of the better docs. Some engines don't have them at all.
[QUOTE=Noi;47043139]I find unity documentation confusing and unhelpful, any links to good docs?[/QUOTE] I think I see where you're coming from. It's not such a long time ago that I'd been there myself. It's best to just follow tutorials at first, get a hang of the basics. Unity docs are built around in circles, they don't really start anywhere. They have a tendency to go like "it's like skyrim with guns" and if you don't know what skyrim is and what guns are you're fucked. So you have to go out and google up a good tutorial for skyrim and a good one for guns and hope it's not just "fallout without guns" and "a neater type of bow." Gets really helpful later on though. You just gotta go and have the basics explained to you like you're 5.
[QUOTE=The Rizzler;47041028]Oh yeahhh, now I see that It would have help if I actually looked up Animator.Play wouldn't it, how about [code]animator.Play("Steer Left", -1, formula);[/code] if the layer is 0 then that's Base right? So -1 is the layer under that? Try that if you still have 0 as the layer parameter, I don't know if -1 is right since the docs don't go into much detail about what that parameter actually refers to Oh ok haha yeah my player animator is a [URL="http://i.gyazo.com/c5e732d9a3701f4d1812682d147ca6dd.png"]mess[/URL] There's some blendtrees and shit in there but I think I need to go over my methods to make something cleaner to look at haha At least it works though right[/QUOTE] Yes, I also tried the one with "-1", and it didn't worked. I think the Unity's animation system is kind of a mess, 50% things are undocumented or documented really badly. Also I feel your pain for your mess, I have similar stuff going on...
I've learned today that Unity treats the Xbox controller's D-pad as an axis and that is making my life so much more difficult than it should be. The more I try to use Unity's input "correctly" the more annoyed I am at specific little things it does.
I believe in the Unity Input options you can set an Axis to not have any in-between.
I ended up writing my own tiny implementations of ButtonDown but for an axis. It wasn't that big of a deal, just something annoying that I don't think should be an issue to begin with. Anyway, I have a more important problem. I want to create an animation in Blender and then through code be able to put the animation at a specific part of it. The example I'm working on now is a throttle. I have an animation for the throttle body that starts at the bottom, and then goes to full throttle. I don't want the animation to play, but instead just go to a specific time of it and stay there. From what I was expecting, I [I]should[/I] be able to just set the time of an animation and that's all, but I don't even know where to start in doing that. Everything appears to be obscured behind the Animator, but at the same time I could just have no idea what I'm talking about. [vid]http://a.pomf.se/tvbbgu.webm[/vid] Is this even the right way to do something like this? I'm really struggling with animation because it's something I've never done before, but there seems like so much overhead required to do what I think would be simple.
[QUOTE=Why485;47055359]Is this even the right way to do something like this? I'm really struggling with animation because it's something I've never done before, but there seems like so much overhead required to do what I think would be simple.[/QUOTE] I'd just animate the throttle entirely through code rather than set up animations and then try to control the animation with code
[QUOTE=The Rizzler;47055456]I'd just animate the throttle entirely through code rather than set up animations and then try to control the animation with code[/QUOTE] I'm of mixed opinions about using animations. There's pros and cons to both methods, so I haven't decided yet on how I'm going to handle all my switches. The nice thing about animations is that I have a built in state machine that I can easily manipulate for more complex motions such as flipping open a switch cover before pressing the switch, or the motion of the throttle going through the afterburner detent. I'd have to do that kind of stuff manually if I went with procedural animations, and some of the more complex motions would be a huge headache. Still, I'm debating doing them the old fashioned way because I know that way much better. For the record, this was the solution I found to the above problem with needing specific frames. [code]virtualThrottle.Play("ThrottleUp", 0, _throttle); virtualThrottle.speed = 0f;[/code] Here's what I'm working on. The idea is basically a space sim but done in a DCS-lite style. I learned Blender over the weekend (coming from 3DS Max, it's super weird and unintuitive) and somehow managed to create this whole cockpit over the course of the day. The important part though is the way that everything works together. The switches in the cockpit are actually functional, but I want to keep the whole thing usable with an Xbox controller. So what I'm doing is instead of clicking on individual switches, which would be really unwieldy with a controller, you instead just point at the relevant panel and then hit the appropriate direction on the D-Pad. I think it works really well already, and with a smarter camera it could work even better. The switches aren't just for show though, the ship is driven by components that talk to each other. I'm still missing a few components, but the most important ones are already implemented. The thrusters drive the generator, which charges the battery and provides power to most of the things in the ship. However when something goes wrong, the resource chain starts to falter. The example in the video deals with electricity, but the most interesting situation with the lights is when you turn off your thrusters you start a chain of events (all a result of resources being passed around, not anything specifically scripted) that ends with the battery dead and your lights off. [media]http://www.youtube.com/watch?v=n0yKKBA7mUI[/media]
Hey, anyone knows how to find the "direction" of particle, which is mesh based? I need to simulate bug/firefly behaviour, you know they fly forward and as they change direction, they fly into that direction?
How would you create a moving platform that the player can stand on? Atm i'm just using Vector3.MoveTo to let it run through some points, but every time the player stands on it, it falls through. The player is not rigidbody based, as i did not deem it necesary for the game (not really action oriented with running and jumping and whatnot). Is there a way i'm missing or should i just rewrite it to include rigidbody?
If there's no rigidbody, feel free to parent it to the platform.
[QUOTE=Fourier;47060644]Hey, anyone knows how to find the "direction" of particle, which is mesh based? I need to simulate bug/firefly behaviour, you know they fly forward and as they change direction, they fly into that direction?[/QUOTE] I don't think it's currently possible to get each individual particles direction, although you may want to check the API. I haven't messed around with particles since a long time ago, before the new particle system. As far as I know it's only possible to see the direction of the entire particle systems emission. It may be overkill, but if necessary you could just have individual bug prefabs and create your own sort of particle system which just instantiates the individual bugs and then destroys them after a certain amount of time. Then each particle could have it's own AI. That's probably what I would do in that situation.
[QUOTE=Duskling;47064842]I don't think it's currently possible to get each individual particles direction, although you may want to check the API. I haven't messed around with particles since a long time ago, before the new particle system. As far as I know it's only possible to see the direction of the entire particle systems emission. It may be overkill, but if necessary you could just have individual bug prefabs and create your own sort of particle system which just instantiates the individual bugs and then destroys them after a certain amount of time. Then each particle could have it's own AI. That's probably what I would do in that situation.[/QUOTE] Yeah, it is doable. But it is really power consuming. Stuff will run on mobiles.
[QUOTE=Drury;47063549]If there's no rigidbody, feel free to parent it to the platform.[/QUOTE] Worked when performed in the editor, but when i try to do it so it happens when the player jumps on the platform, then it doesn't trigger the collision event :f So i just gutted the new fps controller (well from the beta assets but whatever) and used that (it's rigidbody based) Tried using the UFPS asset, but man that thing is huge :P
Is it possible to directly get some values from prefab without instantiating it?
Copypaste? :v: Isn't it like prefabs are always this static thing that doesn't change until instantiated, thus the values are always constant, thus there's really not any need to read them at runtime? Might be wrong.
[QUOTE=Drury;47067049]Copypaste? :v: Isn't it like prefabs are always this static thing that doesn't change until instantiated, thus the values are always constant, thus there's really not any need to read them at runtime? Might be wrong.[/QUOTE] Well I have "Player" and "PlayerGarage" but if I modify "Player" prefab, I want "PlayerGarage" to access those values. I will think of something.. and I think it is possible. I will tell today.
How would you implement an inventory system? To be more specific, in a singleplayer game, how would you save/encrypt the items in the inventory? Saving it as a file somehow, ofcourse...any tips? [editline]3rd February 2015[/editline] [QUOTE=Fourier;47067120]Well I have "Player" and "PlayerGarage" but if I modify "Player" prefab, I want "PlayerGarage" to access those values. I will think of something.. and I think it is possible. I will tell today.[/QUOTE] If you only have 1 player then you could do: [code]player = GameObject.FindGameObjectWithTag (tag).GetComponent (script) as Player;[/code] and then to get a specific variable from the player: [code]var test = player.GetType ().GetField (variable).GetValue (player).ToString ();[/code] at least that's how I get the player's level and show it as text. I do it like this so I can reuse the text script for all kinds of text. [editline]3rd February 2015[/editline] [img]http://i.imgur.com/GaKhpul.png[/img] having to assign every coin manually sucks. how can I get these 9 prefabs through scripting?
[QUOTE=war_man333;47067127]How would you implement an inventory system? To be more specific, in a singleplayer game, how would you save/encrypt the items in the inventory? Saving it as a file somehow, ofcourse...any tips? [editline]3rd February 2015[/editline] If you only have 1 player then you could do: [code]player = GameObject.FindGameObjectWithTag (tag).GetComponent (script) as Player;[/code] and then to get a specific variable from the player: [code]var test = player.GetType ().GetField (variable).GetValue (player).ToString ();[/code] at least that's how I get the player's level and show it as text. I do it like this so I can reuse the text script for all kinds of text. [editline]3rd February 2015[/editline] [img]http://i.imgur.com/GaKhpul.png[/img] having to assign every coin manually sucks. how can I get these 9 prefabs through scripting?[/QUOTE] You can put them into "Resources" folder and then load them via [img]http://i.imgur.com/LHhXJTp.png[/img] [editline]3rd February 2015[/editline] [QUOTE=war_man333;47067127]How would you implement an inventory system? To be more specific, in a singleplayer game, how would you save/encrypt the items in the inventory? Saving it as a file somehow, ofcourse...any tips? [editline]3rd February 2015[/editline] If you only have 1 player then you could do: [code]player = GameObject.FindGameObjectWithTag (tag).GetComponent (script) as Player;[/code] and then to get a specific variable from the player: [code]var test = player.GetType ().GetField (variable).GetValue (player).ToString ();[/code] at least that's how I get the player's level and show it as text. I do it like this so I can reuse the text script for all kinds of text. [editline]3rd February 2015[/editline] [img]http://i.imgur.com/GaKhpul.png[/img] having to assign every coin manually sucks. how can I get these 9 prefabs through scripting?[/QUOTE] For inventory system I use PlayerPrefs. And about encryption, make the encryption later. Just make methods for Loading/Saving inventory. Then if you have those methods, you can flawlessly implement encryption.
[QUOTE=war_man333;47067127] [code]var test = player.GetType ().GetField (variable).GetValue (player).ToString ();[/code] [/QUOTE] w-..w-what
For references to other objects/scripts, is there any advantage to getting them all in-code via [I]GetComponent[/I] and [I]Resources.Load[/I], as opposed to exposing the variables publicly and then assigning them via the editor?
[QUOTE=Fourier;47067158]You can put them into "Resources" folder and then load them via [img]http://i.imgur.com/LHhXJTp.png[/img][/QUOTE] I'm getting 'load can only be loaded from the main thread' am I doing it right? [img]http://i.imgur.com/A8aWQpi.png[/img] [QUOTE=Perl;47067244]w-..w-what[/QUOTE] not entirely sure. I got help from some guy on GDSE. Can't remember the name of this concept.
[QUOTE=war_man333;47067316]I'm getting 'load can only be loaded from the main thread' am I doing it right? [img]http://i.imgur.com/A8aWQpi.png[/img] not entirely sure. I got help from some guy on GDSE. Can't remember the name of this concept.[/QUOTE] Yes, you are doing it correctly. As for thread, you must be running this code in main thread. (dunno just a guess, but if you are on main thread, don't do it on coroutine or something like that, just on Awake() or Start())
[QUOTE=war_man333;47067316] not entirely sure. I got help from some guy on GDSE. Can't remember the name of this concept.[/QUOTE] It was more "why" than "what" actually. You shouldn't be using reflection, it's ugly and slow. Try dictionaries. [code] var coins = new Dictionary<string, ItemPhysics>(); coins["copper"] = Resources.Load<ItemPhysics>("Money/Item_Coin_Copper_1"); coins["copper_5"] = Resources.Load<ItemPhysics>("Money/Item_Coin_Copper_5"); [/code] etc..
Sorry, you need to Log In to post a reply to this thread.