• Unity3D - Discussion
    5,004 replies, posted
I wanted to visualize my lists for debugging. [img]http://puu.sh/bZy6Q/06a5f547cd.png[/img] Works.
[QUOTE=i_speel_good;46151991]Hello everyone, I'm making a small 3D third person game. I have scattered some boxes around the game's map. How I want to use them is, when the player jumps on these, they boost that player in an upwards-forwards direction. Think of it like the boosters in Quake or Unreal Tournament, in the sense that you step on it and it sends you towards a direction. My problem is that I can't get collision detection working at all. My player has a rigid body, a capsule collider and a game controller among its components, and the "booster" box has, among others, a Box collider and a small C# script with this code: [code] using UnityEngine; using System.Collections; public class func_booster : MonoBehaviour{ //public float pushPower = 2.0f; void OnCollisionEnter(Collision collision) { Debug.Log ("it's happening"); } } [/code] When I go ingame and violate the box's personal space with my player, no debug message comes up, which means the collision is not being registered at all, but as the player I can still walk on it (I don't go through the box). Are there any reasons why such a simple collision as this would not register?[/QUOTE] Try an empty game object placed on top of the "booster" mesh with a box collider component added to it, set it as a trigger, and use "OnTriggerEnter" instead. Make sure you move your script over the the trigger object. A plus to this method instead of what I think you're doing is the collision won't trigger if the player hits the side of the booster instead of the top.
[QUOTE=PieClock;46153312]Try an empty game object placed on top of the "booster" mesh with a box collider component added to it, set it as a trigger, and use "OnTriggerEnter" instead. Make sure you move your script over the the trigger object. A plus to this method instead of what I think you're doing is the collision won't trigger if the player hits the side of the booster instead of the top.[/QUOTE] Thanks for the reply! I tried this with a Plane Trigger prior to seeing your response, and while the trigger Debug.Log showed up in my console, I later found that I couldn't give it the functionality I wanted to. I think the problem stems from the fact that the Player object's movement is only goverened by the Character Controller, which means that I can't do things like AddForce to the rigid body. I honestly don't understand why that would be, but after testing it for an exhausting 3 hours, I think it can't be done the way I'm trying to do it. I found [i]some[/i] way to handle it online, but it is very sketchy and doesn't work as well as I'd like it to. [vid]http://a.pomf.se/xsegfw.webm[/vid]
[QUOTE=i_speel_good;46153610] I honestly don't understand why that would be[/QUOTE] Because rigidbodies and character controllers are two vastly different concepts which should NOT be mixed on a single game object, except perhaps to deal with edge cases in Unity (like OnCollision events perhaps), and the rigidbody in any case should be set to kinematic so that it doesn't move the object. What you WANT, if the character is controlled with a character controller, is to keep track of your own velocity. Then, when your character hits the jump platform, you just add a value to that velocity to simulate your own AddForce.
[QUOTE=KillaMaaki;46153813]Because rigidbodies and character controllers are two vastly different concepts which should NOT be mixed on a single game object, except perhaps to deal with edge cases in Unity (like OnCollision events perhaps), and the rigidbody in any case should be set to kinematic so that it doesn't move the object. What you WANT, if the character is controlled with a character controller, is to keep track of your own velocity. Then, when your character hits the jump platform, you just add a value to that velocity to simulate your own AddForce.[/QUOTE] A-ha! So my hypothesis was somewhat correct. Thanks for the info. Apart from the velocity, how do I also simulate the direction I want the player to be thrown at?
How in java/unity do you detect collision? Making sounds play or actions happen when a player touches an object? I've done it before but I'm too new at this to remember how ;_;
[QUOTE=MedicWine;46157830]How in java/unity do you detect collision? Making sounds play or actions happen when a player touches an object? I've done it before but I'm too new at this to remember how ;_;[/QUOTE] First, I'd like to made the distinction between Java and Unity. They are not the same thing. Java is a language and a runtime for that language. Unity is a game engine which does not feature Java as a supported language. As for Unity, Google it. It's easy enough to find.
[QUOTE=MedicWine;46157830]How in java/unity do you detect collision? Making sounds play or actions happen when a player touches an object? I've done it before but I'm too new at this to remember how ;_;[/QUOTE] [url]http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html[/url] This has an example that has everything you're looking for. If you meant JavaScript, know that it's different from Java. Unity uses Javascript, C# and Boo, its integrated scripting solution. Also, like said above, google has every solution to every unity problem you might have! It's awesome like that.
[QUOTE=i_speel_good;46158248] If you meant JavaScript, know that it's different from Java. Unity uses Javascript, C# and Boo, its integrated scripting solution..[/QUOTE] *pedantic mode activated* I'd like to point out that what Unity calls "Javascript" is most definitely not Javascript. It's a custom-built language that is probably best referred to as "Unityscript", and is closer in syntax to ActionScript 3 than it is to Javascript. *pedantic mode deactivated*
[QUOTE=KillaMaaki;46158273]*pedantic mode activated* I'd like to point out that what Unity calls "Javascript" is most definitely not Javascript. It's a custom-built language that is probably best referred to as "Unityscript", and is closer in syntax to ActionScript 3 than it is to Javascript. *pedantic mode deactivated*[/QUOTE] In a thread dedicated to Unity, I believe Javascript/JS are an acceptable terms when referencing script types. Even the official Scripting API uses Javascript/JS as reference for script examples. It's pointless to argue semantics when someone is asking for help and you know exactly what they're referring to.
[QUOTE=foszor;46159496]In a thread dedicated to Unity, I believe Javascript/JS are an acceptable terms when referencing script types. Even the official Scripting API uses Javascript/JS as reference for script examples. It's pointless to argue semantics when someone is asking for help and you know exactly what they're referring to.[/QUOTE] It's a widely accepted term in the Unity community, but nonetheless it's still technically the wrong term. (note the *pedantic mode* in my post :wink:) I would argue that just because something is widely accepted doesn't make it correct.
[QUOTE=KillaMaaki;46159527]It's a widely accepted term in the Unity community, but nonetheless it's still technically the wrong term. (note the *pedantic mode* in my post :wink:) I would argue that just because something is widely accepted doesn't make it correct.[/QUOTE] I completely agree with you. But... maybe instead of taking the time to argue terminology (which we're all clear on) we could help address the question? That was my point. This reminds me of old WAYWO and WDYNHW Gmod threads (maybe not old? I haven't been there in ages) with pages and pages of arguing Lua over LUA and GLua over Lua and... well they weren't very productive threads.
The question was already addressed, there's really no point in addressing it further. I just wanted to point out the Java/Javascript/Unityscript thing.
Oh yea, I haven't put up a video in a while. Been trying to make things work for a while, but in the past few hours I've added in one of the big repairable machines to the demo. I should say that the recording fucked up, apparently fraps halved the framerate so it's all juddery. But since I spent ages getting it to work without fraps I 'ain't fixing it tonight. [video=youtube;5F6Shfbsqo0]http://www.youtube.com/watch?v=5F6Shfbsqo0&feature=youtu.be[/video] (ADDITIONALLY: The GUI currently isn't scaling to resolution, hence the strange placement. All sounds are temporary until I make better ones. This will not actually be the way you activate the machine in game, you'll have to figure out that puzzle yourselves). Also includes music made by the guy who is now doing my music. I was going to announce that I had a guy separately but I forgot. I will refer to him as "The Guy" until I get his permission to say who he is, because I haven't asked him that yet :v:
Just watching the day go by... [video=youtube;LM8RJsgtwhQ]http://www.youtube.com/watch?v=LM8RJsgtwhQ[/video]
[QUOTE=Jcorp;46160292]Oh yea, I haven't put up a video in a while. Been trying to make things work for a while, but in the past few hours I've added in one of the big repairable machines to the demo. I should say that the recording fucked up, apparently fraps halved the framerate so it's all juddery. But since I spent ages getting it to work without fraps I 'ain't fixing it tonight. [video=youtube;5F6Shfbsqo0]http://www.youtube.com/watch?v=5F6Shfbsqo0&feature=youtu.be[/video] (ADDITIONALLY: The GUI currently isn't scaling to resolution, hence the strange placement. All sounds are temporary until I make better ones. This will not actually be the way you activate the machine in game, you'll have to figure out that puzzle yourselves). Also includes music made by the guy who is now doing my music. I was going to announce that I had a guy separately but I forgot. I will refer to him as "The Guy" until I get his permission to say who he is, because I haven't asked him that yet :v:[/QUOTE] I think it would look better if the giant arm moved like something giant and heavy. Right now it seems huge as you approach it but once you activate it, it just seems like it's a small thing that was just scaled way up. Slower movement and such would make it seem truly massive.
[QUOTE=Pelf;46169081]I think it would look better if the giant arm moved like something giant and heavy. Right now it seems huge as you approach it but once you activate it, it just seems like it's a small thing that was just scaled way up. Slower movement and such would make it seem truly massive.[/QUOTE] Oh yeah totally, had that response when I showed it to other people as well. There's another thing like that (big radio transmitter ) that I'm going to give the same treatment. Sound editing for the hydraulics is a massive bugger, though :v: Also; testing upgrades for turrets (to give the player something to do when being attacked). Right now you can repair a damaged turret, but if you repair it over full health another little bar starts to fill up. Doing this costs a steady stream of resources , and when the bar fills up the turret levels up (each level requires more time and resources than the last). Now: should the upgrade be automatic (level 1 increases damage, level 2 rate of fire etc.), or should you be given some options for what type of upgrade you get?
[QUOTE=i_speel_good;46158248][url]http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html[/url] This has an example that has everything you're looking for. If you meant JavaScript, know that it's different from Java. Unity uses Javascript, C# and Boo, its integrated scripting solution. Also, like said above, google has every solution to every unity problem you might have! It's awesome like that.[/QUOTE] Thanks. and yea, I just mean unity+java sorry. I know the difference.
[QUOTE=MedicWine;46169977]Thanks. and yea, I just mean unity+java sorry. I know the difference.[/QUOTE] But why would you be asking about both? The two are very different things, and you're better off asking a more Java-oriented community how to do what you're looking for there (besides which, there's no standard way of doing it in Java, just as with any language)
[QUOTE=MedicWine;46169977]Thanks. and yea, I just mean unity+java sorry. I know the difference.[/QUOTE] If you know the difference you probably meant Unity + Javascript?
No, Mecanim, that's not... I... ugh. [vid]http://www.mophogames.com/Files/FPS%20Kit%20Animation%20Bug.webm[/vid]
Looks okay for me
Oh my sweet dick. My first attempt at creating an inventory system using Unity 4.6 and the new UI. Holy crap I didn't think it'd be so complicated. Does anyone have any tips for this? Should I use the 4.6 grid sorting component, or make my own?
How do I get SerializedObject.FindProperty to work on actual C# Properties and not just fields?
[QUOTE=AtomiCal;46181652]How do I get SerializedObject.FindProperty to work on actual C# Properties and not just fields?[/QUOTE] You don't. Unity's serialization stuff does not work on properties.
Hello, I have a bit of a problem if anyone got anything similiar. Well it goes like this. I have one scene (menu) where you can load levels. When I click on button, I call Application.LoadLevel("randomname"), but problem is that when this level is loaded, it says " coroutines could not be executed because object is not enabled." Well the gameObject and script is enabled and you know, this bug happens only once I run the unity. Second time I make same test, it runs fine. So I am really baffled, anyone kind enough has some ideas what do to/try? Thanks.
Tried to throw in some bot AI to test against >.> [vid]http://www.mophogames.com/Files/FPSKit7.webm[/vid]
does anyone know how to change the size of an instantiated cube object's rigidbody collider, while leaving the cube looking the same?
[QUOTE=Turnips5;46195646]does anyone know how to change the size of an instantiated cube object's rigidbody collider, while leaving the cube looking the same?[/QUOTE] You'd just access the 3D collider component with getcomponent, wouldn't you?
[QUOTE=Maloof?;46195677]You'd just access the 3D collider component with getcomponent, wouldn't you?[/QUOTE] ah god, I was trying to get <Collider> instead of <BoxCollider> and wondering why the size field wasn't available. thanks
Sorry, you need to Log In to post a reply to this thread.