• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=Drury;46912502]So here's what I have *code* Needless to say it doesn't work. It does kinda simulate friction from all directions (not what I want but close), but when I push it in a funny way it spins out and goes all across the place. If I don't multiply by 20, it's barely noticeable. I've tried to counter rotation with sine and cosine as well but no luck. I lack the experience to do this properly I guess. [editline]12th January 2015[/editline] And yeah if I replace rigidbody2D.velocity.y with 0 in addforce just goes off when I touch it.[/QUOTE] I've had to do something similar to this before, albeit in 3D, where i wanted to kill relative x and y velocity leaving only relative z velocity, and I ended up doing this: [CODE]Vector3 relativeVelocity = transform.InverseTransformDirection(rigidbody.velocity); relativeVelocity.x *= floatiness; relativeVelocity.y *= floatiness; rigidbody.velocity = transform.TransformDirection(relativeVelocity);[/CODE] You would put this after you apply your force. The floatiness value would be a value from 0 to 1. In your case you would probably just use the X value. Also I made a few demo scenes for that AI waypoint graph thing I posted a little while back. There's 3 of them so here's the link to the page where they are: [url]http://www.roadturtlegames.com/?page_id=369[/url] I'm just wondering if this is something worth selling. With all of the other alternatives out there that are probably more well-made I'm just having a hard time convincing myself that it is, despite how much work I've put into it. If you are interested at all of the other stuff it does, you can take a look at the docs I made: [url]http://www.roadturtlegames.com/?ddownload=366[/url]
Cool you guys, seems to have done the trick. Will report back when the rest of the truck works.
[QUOTE=Garrison;46907041]Has anyone used [URL="https://www.assetstore.unity3d.com/en/#!/content/23569"]RAIN[/URL] before? If you have can you give me a quick rundown on how it works, all of the tutorials I've seen don't give me a simple AI setup they go for the most complex system and I just want a capsule to chase a player if it sees them.[/QUOTE] Has anyone found any 2D tutorials for this? I found one but it's dated as heck so every script/entity is called something different now.
Welp, this is just not meant to be. How do I go about making fixed wheels perfectly stuck to a rigidbody, not randomly spazzing across? I have them on a hinge joint with rotation fixed to 0 and fixed in place by 2 distance joints. Doesn't prevent them from turning 90 degrees like it's nothing.
oh my god I am going nuts. I've been trying to download images from imgur with WWW and use them as sprites, but every single time I try to request an image, I get a 400 Bad Request. My URLs appear to be fine, and the odd thing? if I open these links on Google Chrome, then try to download them in unity? the error vanishes. it works just fine.
[QUOTE=cam64DD;46920760]oh my god I am going nuts. I've been trying to download images from imgur with WWW and use them as sprites, but every single time I try to request an image, I get a 400 Bad Request. My URLs appear to be fine, and the odd thing? if I open these links on Google Chrome, then try to download them in unity? the error vanishes. it works just fine.[/QUOTE] Just a shot in the dark... are they private images and maybe you need to login to view them?
[QUOTE=foszor;46920807]Just a shot in the dark... are they private images and maybe you need to login to view them?[/QUOTE] Nope. Uploaded anonymously, anyone can view em!
Hello, anyone has idea why I am getting z-buffer fight or z-fight suddenly, even if triangles are not really close sometimes I see pixels from back leaking.. fucked up really.. :( Oh, it's OpenGL 2.0 ES emulation. But still, it appeared suddenly. Weird, It has disappeared...
[QUOTE=Fourier;46921066]Hello, anyone has idea why I am getting z-buffer fight or z-fight suddenly, even if triangles are not really close sometimes I see pixels from back leaking.. fucked up really.. :( Oh, it's OpenGL 2.0 ES emulation. But still, it appeared suddenly. Weird, It has disappeared...[/QUOTE] Move the the near, and the far plane closer together.
[url=http://www.reddit.com/r/Unity2D/comments/2segao/topdown_car_issues/]Well this rabbit hole sure goes deep.[/url]
[QUOTE=Drury;46930641][url=http://www.reddit.com/r/Unity2D/comments/2segao/topdown_car_issues/]Well this rabbit hole sure goes deep.[/url][/QUOTE] Looks like you need an alignment. [img]http://i.imgur.com/BbgL7x3.gif[/img] Sorry, bad joke.
Pls don't make joke I am crying my eyes out over here. [editline]14th January 2015[/editline] Oh wow is solve [editline]14th January 2015[/editline] :suicide:
What shader method would I use to accomplish blending two transparent sprites without adding them together? [img]http://puu.sh/ex76r/97af8bccc7.png[/img]
i have no idea how to implement this but how about max()ing the source and destination channels
[QUOTE=foszor;46936398]What shader method would I use to accomplish blending two transparent sprites without adding them together? [img]http://puu.sh/ex76r/97af8bccc7.png[/img][/QUOTE] In OpenGL you would just call glDisablei(GL_BLEND, i)​, where i is the buffer you want to disable blending on. You could alternatively send the blend equation to GL_MAX
[QUOTE=foszor;46936398]What shader method would I use to accomplish blending two transparent sprites without adding them together? [IMG]http://puu.sh/ex76r/97af8bccc7.png[/IMG][/QUOTE] "Blend Off" should work. You're gonna have to edit or make your own shader though. [URL]http://docs.unity3d.com/Manual/SL-Blend.html[/URL]
I'm trying to figure out how to do 2D movement using rigidbody2D.MovePosition(). I got left and right movement working good but I need to get jumping working. Right now if the player isn't grounded I do a MovePosition that applies "gravity" and one without any "gravity" when grounded. I know I'll probably need to do some fancy math to get a smooth jump but I just can't think of how I could do it. Anyone with ideas would be appreciated. My current code is a little messy because I just been trying different things all day. [code]public void Move(float move, bool jump) { float _gravity = useGravity ? gravity : 0; float _jump = jump ? 1 : 0; if(isGrounded) { rigid2D.MovePosition(rigidbody2D.position + new Vector2(move * maxSpeed, _jump * 120) * Time.deltaTime); } if(!isGrounded && canAirControl) { rigid2D.MovePosition(rigidbody2D.position + new Vector2(move * maxSpeed, _gravity) * Time.deltaTime); } if(isCollidingLeft && move < 0) { //rigidbody2D.velocity = new Vector2(0, rigidbody2D.velocity.y); } else if(isCollidingRight && move > 0) { //rigidbody2D.velocity = new Vector2(0, rigidbody2D.velocity.y); } if ((isCollidingLeft || isCollidingRight) && (!isGrounded && rigidbody2D.velocity.y < 0)) { //rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, rigidbody2D.velocity.y + 0.2f); } if (isGrounded && jump) { // Add a vertical force to the player. //rigidbody2D.AddForce(new Vector2(0f, stats.jumpHeight), ForceMode2D.Impulse); jumpCount++; } else if(jump && stats.maxJumps > 1 && jumpCount < stats.maxJumps) { //rigidbody2D.AddForce(new Vector2(0f, stats.jumpHeight), ForceMode2D.Impulse); jumpCount++; } }[/code]
[QUOTE=Kidd;46950905]I'm trying to figure out how to do 2D movement using rigidbody2D.MovePosition(). I got left and right movement working good but I need to get jumping working. Right now if the player isn't grounded I do a MovePosition that applies "gravity" and one without any "gravity" when grounded. I know I'll probably need to do some fancy math to get a smooth jump but I just can't think of how I could do it. Anyone with ideas would be appreciated. My current code is a little messy because I just been trying different things all day. [code]public void Move(float move, bool jump) { float _gravity = useGravity ? gravity : 0; float _jump = jump ? 1 : 0; if(isGrounded) { rigid2D.MovePosition(rigidbody2D.position + new Vector2(move * maxSpeed, _jump * 120) * Time.deltaTime); } if(!isGrounded && canAirControl) { rigid2D.MovePosition(rigidbody2D.position + new Vector2(move * maxSpeed, _gravity) * Time.deltaTime); } if(isCollidingLeft && move < 0) { //rigidbody2D.velocity = new Vector2(0, rigidbody2D.velocity.y); } else if(isCollidingRight && move > 0) { //rigidbody2D.velocity = new Vector2(0, rigidbody2D.velocity.y); } if ((isCollidingLeft || isCollidingRight) && (!isGrounded && rigidbody2D.velocity.y < 0)) { //rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, rigidbody2D.velocity.y + 0.2f); } if (isGrounded && jump) { // Add a vertical force to the player. //rigidbody2D.AddForce(new Vector2(0f, stats.jumpHeight), ForceMode2D.Impulse); jumpCount++; } else if(jump && stats.maxJumps > 1 && jumpCount < stats.maxJumps) { //rigidbody2D.AddForce(new Vector2(0f, stats.jumpHeight), ForceMode2D.Impulse); jumpCount++; } }[/code][/QUOTE] Looks like you might be applying jump for a single frame. You might want to consider using a persistent velocity variable and adjusting it with each move update. [code] private Vector2 velocity = Vector2.zero; public void move( float move, bool jump ) { velocity.x = move * maxSpeed; if ( isGrounded && jump ) velocity.y = jumpSpeed; else velocity.y = Mathf.Max( velocity.y - someFallSpeed, maxFallSpeed ) ridig2D.MovePosition( transform.position * velocity * Time.deltaTime ); } [/code] I wrote that in the reply box, so it's just pseudo code and untested. [editline]16th January 2015[/editline] You'll have to add some horizontal movement dampening too.
Unity remote isn't working.
It's a start I guess. Not sure if it is possible to embed a gfycat link. [img]http://fat.gfycat.com/OddballClumsyHumpbackwhale.gif[/img]
[QUOTE=Carlton Dance;46952739]Unity remote isn't working.[/QUOTE] You'll have to be more specific on that one, if you want us to help you. General Tips, Using Unity Remote Connection for your Android phone to the editor window: Be sure to have the drivers installed, adb.exe running, and have your android phone in developer mode ( As well as allowing to install apps through USB debugging )
I made a simple loading scene with some text that just says loading and obviously loads some content. However instead of switching scenes then making the player wait while things load, it loads and slows down a ton then switches scenes briefly and stays on the loading scene for only the last one or two seconds of the load. Not sure what to do. I know its kind of vague but if anyone has run into the same problem or has a solution help would be appreciated. Thanks!
[QUOTE=MadPro119;46977325]I made a simple loading scene with some text that just says loading and obviously loads some content. However instead of switching scenes then making the player wait while things load, it loads and slows down a ton then switches scenes briefly and stays on the loading scene for only the last one or two seconds of the load. Not sure what to do. I know its kind of vague but if anyone has run into the same problem or has a solution help would be appreciated. Thanks![/QUOTE] Are you using a coroutine to load the content in loading scene?
So I learned of a really damn cool trick for custom List<T>-style implementations for quickly removing elements if you don't care about the order of the items in the list. Turns out you can just copy the last element of the list to the index you want to remove from, then decrement the list count. Made a post about this on my blog with a download link for a modified version of the FastList class that ships with DFVoice (modified from the version that ships with DFGUI) [url]http://www.mophogames.com/fast-list-with-swap-removal-trick/[/url]
Is there a way in Unity, with 2D, to support all resolutions without revealing/hiding more of the level, and without stretching? Scaling is ofc. fine, I don't need it to be pixel perfect [editline]22nd January 2015[/editline] I found a nice little script that fixes my problem [URL="http://gamedev.stackexchange.com/questions/79546/how-do-you-handle-aspect-ratio-differences-with-unity-2d"]here[/URL]
Been upgrading my game to Unity 5. Something's not quite right here. [video=youtube;naOAmkuVWPo]http://www.youtube.com/watch?v=naOAmkuVWPo[/video]
when are we going to get unity 5
I'm starting my first project. My idea was that it would be a simple and not too elaborate game made using some basic tweaks to the first-person controller and terrain, maybe even a few homemade models, etc, just to help me get used to the code structure. Any suggestions for a concept?
[QUOTE=PaperBurrito;46991685]I'm starting my first project. My idea was that it would be a simple and not too elaborate game made using some basic tweaks to the first-person controller and terrain, maybe even a few homemade models, etc, just to help me get used to the code structure. Any suggestions for a concept?[/QUOTE] walk around, collect objects and use them on the environment (literally press E to pick up lever, press E to place shouldn't be hard) to escape/achieve an objective like surviving on an island or escaping a room or fixing a machine or something
Has anyone come across a proper method for making a secure connection to a website? I know how to create an interface between the database and the client (i.e. PHP script) but how can I ensure its a game client connecting to the PHP script and not someone dicking around?
Sorry, you need to Log In to post a reply to this thread.