• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=Saccn;44591343] -Snip- Does anyone know how to make a decent fps camera? The one I'm currently using keeps stuttering whenever I move, cause the camera is parented to a rigidbody. If I comment out the lines that control camera rotation, the stuttering goes away. I have interpolation set to on on the rigidbody.[/QUOTE] Have you try using void FixedUpdate()? Nice particle system! I need to start messing with those stuff again <_< Be sure not to have the input in the FixedUpdate, as they tend not to respond exactly as you wanted it to do. Has anyone done a subtitle script? I did managed to make one, but it's not flexible. At least it works <_<
Is there a way to convert .43-like files from Unity Assets to something like .OBJ or .MAX?
[QUOTE=Over-Run;44561656][url]http://puu.sh/8b3JB.jpg[/url] Theres a picture of the inspector. It isn't going to 1 anyway.[/QUOTE] If it doesn't work, you could always do Zeno's Paradox in the lerp. e.g. transform.position = Vector3.Lerp( transform.position , targetPosition, Time.timeDelta / 0.5f ); or simply copy and paste this; [CODE] Vector3 targetPosition = transform.position + transform.forward * holdDistance; // Define what your target position rigid.MovePosition( Vector3.Lerp( rigid.transform.position , targetPosition, Time.timeDelta / 0.5f )); // Zeno paradox, continuously calculating the object close to targetposition, but not exactly. [/CODE] In short, no matter how fast you move nor where your object is, the lerp will always calculate towards B in a paradox form (So it'll be continuously update, until the state changes)
Okay so what the christ is wrong with this code. I'm new with using Unity and not sure what's wrong with this script. [code] void Update () { CharacterController cc; cc = GetComponent<CharacterController> (); float forwardSpeed = Input.GetAxis (Vertical); Vector3 speed = new Vector3 ( 0, 0, forwardSpeed ) cc.SimpleMove ( speed ); } [/code] "Unexpected symbol cc" in the cc.SimpleMove line, even though it's clearly defined earlier. Rearranging the code throws the same error about CharacterController in the declaration like, even though that's an autocomplete option and can't possibly be an unexpected symbol. I apologize if this is the wrong thread, I figured I could get better help here.
You forgot a semicolon (;) on the line before. Without the semicolon, that line and the next were being read as one line like this: [CODE]Vector3 speed = new Vector3 ( 0, 0, forwardSpeed ) cc.SimpleMove ( speed );[/CODE]
[QUOTE=Pelf;44593002]You forgot a semicolon (;) on the line before.[/QUOTE] Thank you very much, I feel stupid. Now it's throwing me an error about the float declaration - I've tried it with Vertical surrounded by and not surrounded by quotes, but it says that 'Vertical' does not exist in the current context.
snip
[QUOTE=Wave160;44588781]I use [URL="https://trello.com/"]Trello[/URL], and so does [URL="https://trello.com/b/lG8jtz6v/rust-main"]Facepunch Studios for Rust[/URL].[/QUOTE] Yeah Trello seems perfect for my means, will even help me sort out all the other tasks I need doing in my life :v: thanks for the suggestions
So I managed to get pretty far with my basic movement system (with crap placeholder animations) after I figured out how to harness the mysterious power of quaternions! [unity]https://dl.dropboxusercontent.com/u/38815438/Movement%20testing/Movement%20testing.unity3d[/unity] I've been programming climbing in the last few days and I'm certain I'm doing it in the shoddiest way possible with raytracing; even though I've locked a player to a certain terminal velocity when falling, I still get detection inconsistency and completely miss the detection of triggers at higher speeds My guess is that I need a higher "check frequency" for rays - should I put the calculations in FixedUpdate and up the fixed timestep? Or should I ditch it and try and use collision into triggers instead (I think collisions are computed separately and would be more accurate?) [Editline]00:08[/editline] Just found this - [url]https://www.youtube.com/watch?v=GFu44oeLYPI&feature=relmfu[/url] Damn good solution. What would I use in place of the raycast cylinder, CapsuleCast?
Have anyone got decent experience with Unity's networking, or knows a decent (free) alternative to it? I've found it to be extremely lacklustre in certain areas, and kind of hard to use. The problem I'm having is trying to make an authoritative server in a (relatively) P2P environment. Client 1 creates a server, then Client 2 - * join Client 1's server. I'm trying to make it so Client 1('s server) is what sends out all instantiates and thus controls all (or most) movement and objects. The problem is that things like RPC can return no data, and I'm not entirely clear on how some of the views work. Most of it works fine, but with a lack of being able to send things (like arrays) it makes it difficult to do things like pooling or caching enemies. A lot of the instantiating is done with code like this [code] if(networkView.isMine) { Network.Instantiate(Resources.Load(path),loc,ang,view); } [/code] This is done from a script on a GameObject that is present on both Client 1 (server) and all subsequent clients. Objects get deleted as such: [code] if(networkView.isMine) { Network.Destroy(gameObject); } [/code] This is called from the objects themselves, or from the main script. I occasionally get missing networkview errors (which I believe are from deletions), or strange de-synchronizations. Along with that, there is still the (aforementioned) problems of being unable to transfer certain data-types, so I'm stuck with doing things like bouncing data around in arrays between RPCs, and I'm not even sure the data is correct (like, networkviews don't seem to refer to the same object on client <-> server sometimes).
As far as returning data - that's because an RPC is nothing more than sending a message to a remote machine. Of course they don't return data - they are asynchronous by nature, if it returned data it would have to freeze the game until data was returned by the remote machine, which is utterly useless. The best way to handle that case is to structure your RPCs as request/response pairs. So let's say I want to ask the server how many kills I have - database style. Let's structure this into two functions. First, the request function. Remember, this one is executed on the server (client sends message to server): [code] [RPC] public void Request_GetKills( NetworkMessageInfo info ) { // somehow find out how many kills the player has int kills = GetKillsSomehow( info.sender ); // send it back to the client networkView.RPC( "Response_GetKills", info.sender, kills ); } [/code] Now the response function. Remember, this one is executed on the client: [code] [RPC] public void Response_GetKills( int kills ) { // now we know how many kills we have! } [/code] That's how uLink recommends you structure things (uLink is an alternative but almost identical networking API that is designed for dedicated server applications, but it's fairly spendy - $800 for a license, but for that price you'll find they simply didn't miss anything!) As far as that instantiate method, you are passing 'view'. What is that, and why are you passing it? Just curious, could help diagnose issues. Now all of that said I will say Unity Networking is a pile of horsecrap that has been left to fester for days and then lit on fire. If you really need a dedicated server solution, you really want uLink. It's expensive, but if you can afford it I say get it. It's got an authoritative server mode (state synchronization only works from server -> client, and clients can only send RPCs to the server rather than other clients - that way they can't send RPCs that spoof server messages), it's got player approval systems (you can implement an OnApprove callback to approve or deny incoming connections to for example add a banning system, unlike Unity Networking), it's got unreliable RPCs, it's got the concept of different prefabs for different roles (so your Player prefab for instance might be split into different variations for Owner, Server, Proxy, etc), it's got login/approval data (your client can send data to the server prior to connecting, which the server can use in the aforementioned OnApprove function - for example you can check a player's login credentials by calling Wait and querying a database, and then calling either Approve or Deny depending on the results), and holy wall of text batman this is getting long. Anyway, it's expensive though. If you can't afford it, I'd say you'll have to settle for redesigning your game to a more P2P design and going with Photon Cloud - no serverside logic, but still loads better than Unity Networking and much cheaper than uLink. EDIT: Oh, and uLink also supports more data types over RPC. Some base types, arrays of those types, classes and structs with those types as fields, etc.
[QUOTE=KillaMaaki;44611516]snip[/QUOTE] Thanks for that insight; I had the vague idea of doing something like that, but I wasn't entirely sure if it would work. In the instantiate, 'view' is just the group variable, in case players are in different zones/levels. If I had 800$ for uLink, I'd probably buy half a dozen other easier solutions, but unfortunately, I'm poor as, so I have to write all this myself. I will try redesigning my networking to work like this, and hopefully it'll work a little better.
A little tip: simply calling network.destroy does not remove the object from the rpc buffer. In order to prevent the object being instantiated on newly connected players you have to call Network.RemoveRPCs as well.
By the way this is a thing. [url]https://github.com/fholm/udpkit[/url]
[QUOTE=reevezy67;44612601]By the way this is a thing. [url]https://github.com/fholm/udpkit[/url][/QUOTE] This looks interesting, I'll take a gander at it. Thanks!
So collision with triggers is indeed about 100 times more responsive than raytraces, which is excellent, but i'm a bit stuck with just how to implement them My old implementation of raytracing only checked if the player's vertical velocity was <= 0 and was not grounded in order to activate climbing when hitting a valid trigger: [t]http://i.imgur.com/cwxuA0k.png[/t] With the old method the rays were shot out from around the shoulder/neck area to check the ledge - but how do I detect that the climbing trigger is at shoulder height before activating climbing (position snapping to ledge, rotating, animations etc)? [t]http://i.imgur.com/r7ZTzEu.png[/t] OnCollisionStay lets me check for a trigger every frame, but my player collider goes right down to his feet so I don't want the player to snap to a ledge if his toes tap it Any tips? [Editline]19:11[/Editline] Think i'll head in this direction actually, I'll get the world coordinates of the trigger and the player and figure out the difference in y, and if within a certain y distance activate the grab [t]http://i.imgur.com/RM5muZ7.png[/t] But how would I figure out if the player is facing the trigger or not within a certain angle?
[QUOTE=The Rizzler;44615221]So collision with triggers is indeed about 100 times more responsive than raytraces, which is excellent, but i'm a bit stuck with just how to implement them My old implementation of raytracing only checked if the player's vertical velocity was <= 0 and was not grounded in order to activate climbing when hitting a valid trigger: [t]http://i.imgur.com/cwxuA0k.png[/t] With the old method the rays were shot out from around the shoulder/neck area to check the ledge - but how do I detect that the climbing trigger is at shoulder height before activating climbing (position snapping to ledge, rotating, animations etc)? [t]http://i.imgur.com/r7ZTzEu.png[/t] OnCollisionStay lets me check for a trigger every frame, but my player collider goes right down to his feet so I don't want the player to snap to a ledge if his toes tap it Any tips? [Editline]19:11[/Editline] Think i'll head in this direction actually, I'll get the world coordinates of the trigger and the player and figure out the difference in y, and if within a certain y distance activate the grab [t]http://i.imgur.com/RM5muZ7.png[/t] But how would I figure out if the player is facing the trigger or not?[/QUOTE]Haven't worked that much with Unity but you could do something like "on collision then cast a ray towards the trigger, if it hits it then you face it"
[QUOTE=dije;44615431]Haven't worked that much with Unity but you could do something like "on collision then cast a ray towards the trigger, if it hits it then you face it"[/QUOTE] that would probably work, I already have the code to orient the player to the hit normal of the trigger surface, and the ray could be triggered on the collision frame by the increased accuracy of the collision detection... a combined method, worth a shot!
[QUOTE=The Rizzler;44608637]So I managed to get pretty far with my basic movement system (with crap placeholder animations) after I figured out how to harness the mysterious power of quaternions! (unity) I've been programming climbing in the last few days and I'm certain I'm doing it in the shoddiest way possible with raytracing; even though I've locked a player to a certain terminal velocity when falling, I still get detection inconsistency and completely miss the detection of triggers at higher speeds My guess is that I need a higher "check frequency" for rays - should I put the calculations in FixedUpdate and up the fixed timestep? Or should I ditch it and try and use collision into triggers instead (I think collisions are computed separately and would be more accurate?) [Editline]00:08[/editline] Just found this - [url]https://www.youtube.com/watch?v=GFu44oeLYPI&feature=relmfu[/url] Damn good solution. What would I use in place of the raycast cylinder, CapsuleCast?[/QUOTE] Jumping into the big sphere made all weird things happen. [IMG]http://i.imgur.com/45vDbK8.png[/IMG]
[QUOTE=Wave160;44615930]Jumping into the big sphere made all weird things happen. [t]http://i.imgur.com/45vDbK8.png[/t][/QUOTE] haha yeah :v: the ominous grey sphere has the same tag as the climbing triggers, so the player Quaternion.LookRotations towards whatever normal on the sphere it hits first, works fine for planes, not so well for spheres you should have seen it when I was trying to propel the player towards the ledge when activating climbing, pretty sure when I jumped at the sphere I managed to transport myself to world coordinates previously uncharted by man [QUOTE=dije;44615431]Haven't worked that much with Unity but you could do something like "on collision then cast a ray towards the trigger, if it hits it then you face it"[/QUOTE] it didn't work out, the collision detection is highly responsive but the raycasting is just too slow to update, causing inconsistency. damn I'm starting to think I should just shoot out a handful more raycasts in the hope of catching the trigger between frames at high speeds, or just use huge trigger boxes on the ledges I really wanted an airtight method, guess i'll put it on the backburner for now since the climbing system is currently acceptably functional
Playing around with image effects and PBR in Unity... No idea how to embed Unity player. Do I just drop the link here... or...? EDIT: Ah figured it out [unity]https://dl.dropboxusercontent.com/u/99106620/TestFPSGraphics.unity3d[/unity] Might require a fairly decent graphics card, don't know (only tested on GT 780 Ti so far - used 10% of my GPU power) 1.) Physically based shading 2.) Modified Screen space ambient occlusion [I](Changed random vector size to 4x4 which seems to help reduce noisiness/blotchiness)[/I] 3.) Sun shafts 4.) Dirty lens effect 5.) Screen space motion blur 6.) HDR and tonemapping
Looks pretty cool! I'm still trying to get my head around some stuff, then i'll post my project here :)
Need a bit of help. I have this code [CODE] private void Catch() { Debug.Log("Catch"); Vector3 targetPosition = transform.position + transform.forward * holdDistance; rigid.MovePosition(Vector3.Lerp(rigid.transform.position, targetPosition, Time.deltaTime / 0.2f)); inHeldState = true; if(isSelectedSpell && SixenseInput.Controllers[1].GetButtonDown(SixenseButtons.BUMPER)) physicsSpellState = PhysicsSpellState.Occupied; }[/CODE] Basically when I pick up an object I use Lerp to make it move smoothly to my weapon position. However, it only works when I have that if statement there. If I remove the if statement it snaps to the position and the lerp doesn't work. I need to remove the if statement because when it is there, I need to press the bumper button twice to release it, and I only want it pressed once. Any ideas?
Finally got back to continue what I was working on before the cluster of time confusing stuff that is the Easter period. Lot of stuff still buggy but most of the behind the scenes code is in place. Added the power system which isn't working 100% but will, rating system almost in. Next then will be the adjustments for how tenants react to the different types of nearby units. [unity]https://dl.dropboxusercontent.com/u/10044881/Unity/TowersPrototype%200.3/TowersPrototype%200.3.unity3d[/unity] [editline]23rd April 2014[/editline] And excuse the shitty UI
One of my art student friends was talking about wanting to come up with a game to do art for. Essentially the concept it, build a shell platformer just so art can be applied to it and fine tune it until its playable. He was really inspired by the idea of having our character have a mustache, so he left me alone for easter break with nothing but that in mind. I know my way around Unity, I though. I could certainly follow a tutorial through for a bit, and branch off on my own when I think I'm good and ready. If you do some searching, you can probably find the tutorials I mentioned because I just straight up used to the sprites from there, but with a few tweaks. Hence, the mustache. It was incredibly easy, and while it doesn't exactly look finished, its possible. He told me about this idea, and I thought, damn I don't have any idea how to make this work. I mean, would you animate the frames in 32bit like the character and just have the character be a parent of the mustache? So far I think it looks nice (although a bit long, and it gets even longer with some of the speeds you can get up to by using moving platforms to boost horizontal movement) with just a trail effect on an invisible object. Although I havent mastered the lighting and materials on the trail effect yet. [media]http://www.youtube.com/watch?v=X-J7zVyh7yU&feature=youtu.be[/media]
[QUOTE=Over-Run;44621906]Need a bit of help. I have this code [CODE] private void Catch() { Debug.Log("Catch"); Vector3 targetPosition = transform.position + transform.forward * holdDistance; rigid.MovePosition(Vector3.Lerp(rigid.transform.position, targetPosition, Time.deltaTime / 0.2f)); inHeldState = true; if(isSelectedSpell && SixenseInput.Controllers[1].GetButtonDown(SixenseButtons.BUMPER)) physicsSpellState = PhysicsSpellState.Occupied; }[/CODE] Basically when I pick up an object I use Lerp to make it move smoothly to my weapon position. However, it only works when I have that if statement there. If I remove the if statement it snaps to the position and the lerp doesn't work. I need to remove the if statement because when it is there, I need to press the bumper button twice to release it, and I only want it pressed once. Any ideas?[/QUOTE] Sorry I didn't respond to your PM! I had to leave and completely forgot. How about only switching to the Occupied spell state if the lerp is on the target position, or at least in Distance() < 0.1f or some bias.
[QUOTE=KillaMaaki;44618965]Playing around with image effects and PBR in Unity... No idea how to embed Unity player. Do I just drop the link here... or...? EDIT: Ah figured it out Might require a fairly decent graphics card, don't know (only tested on GT 780 Ti so far - used 10% of my GPU power) 1.) Physically based shading 2.) Modified Screen space ambient occlusion [I](Changed random vector size to 4x4 which seems to help reduce noisiness/blotchiness)[/I] 3.) Sun shafts 4.) Dirty lens effect 5.) Screen space motion blur 6.) HDR and tonemapping[/QUOTE] Hmm, tooo blury
[QUOTE=KillaMaaki;44618965]Playing around with image effects and PBR in Unity... No idea how to embed Unity player. Do I just drop the link here... or...? EDIT: Ah figured it out Might require a fairly decent graphics card, don't know (only tested on GT 780 Ti so far - used 10% of my GPU power) 1.) Physically based shading 2.) Modified Screen space ambient occlusion [I](Changed random vector size to 4x4 which seems to help reduce noisiness/blotchiness)[/I] 3.) Sun shafts 4.) Dirty lens effect 5.) Screen space motion blur 6.) HDR and tonemapping[/QUOTE] Running it really smooth with an ati 6670 and looking really gr8! Maybe motion blur it's just a bit...Exagerated, but like this! And remove the dirty lens effect, doesn't look too good...
Runs great on my GTX 650 Ti, but I agree with the dirty camera effect.
[QUOTE=Asgard;44622361]Sorry I didn't respond to your PM! I had to leave and completely forgot. How about only switching to the Occupied spell state if the lerp is on the target position, or at least in Distance() < 0.1f or some bias.[/QUOTE] No problem, Skibur added me on steam and helped me fix it :) How exactly do I do that check? In the if statement should it be something like if(rigid.position == transform.position) or something like that?
Sorry, you need to Log In to post a reply to this thread.