Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

216 Neutral

About Adyrhan

  • Rank
  1. I'm playing a little bit with unity trying to create some kind of dust field which I've started by creating small sphere objects inside the bounds of a box collider. The problem that I have is that when I rotate the parent object of the one that carries such box collider, the spheres get placed outside of the bounds. Why is it? I've set all sizes to 1, so it doesn't scale when calling TransformPoint. UPDATE: Just found out, that the size property of the box collider bounds varies with rotation. I don't know exactly why, but I guess it recalculates the size of the box not taking into account that the box is rotated, so when rotated 45º degrees it says its bigger. I've been trying to retrieve the size value in Start and Awake events but its already changed from the original value I've set up in the editor. In the docs, http://docs.unity3d.com/ScriptReference/Bounds.html I only see two relevant properties related to the size that aren't related to the position, size and extents, but both change when rotated. What could I do to retrieve the original size I've set in the editor? SOLUTION: I was looking at the wrong property of the boxcollider. Its not boxcollider.bounds the one that gives me local space data, but boxcollider.size. Here is the code I wrote for placing the objects:   public class DustFieldCreator : MonoBehaviour { // Use this for initialization public GameObject DustObject; public GameObject World; public int Particles; private BoxCollider boxCollider; private const float limitPerAxis = 1; // Ratio. This was used to resize the effective bounds for testing. Don't mind :D void Start () { boxCollider = GetComponent<BoxCollider>(); createField(); } private void createField() { for (int i = 0; i < Particles; i++) { float xpos = Random.Range(((boxCollider.bounds.size.x / 2) * -1) * limitPerAxis, (boxCollider.bounds.size.x / 2) * limitPerAxis); float ypos = Random.Range(((boxCollider.bounds.size.y / 2) * -1) * limitPerAxis, (boxCollider.bounds.size.y / 2) * limitPerAxis); float zpos = Random.Range(((boxCollider.bounds.size.z / 2) * -1) * limitPerAxis, (boxCollider.bounds.size.z / 2) * limitPerAxis); createParticle(xpos, ypos, zpos); } } private void createParticle(float x, float y, float z) { GameObject dustInstance = (GameObject)GameObject.Instantiate(DustObject); dustInstance.transform.parent = World.transform; Vector3 dustPosition = new Vector3(x, y, z); dustPosition = transform.TransformPoint(dustPosition); dustInstance.transform.localPosition = dustPosition; DustBall ball = dustInstance.GetComponent<DustBall>(); ball.DustField = gameObject; } public void createParticleInFront() { float xpos = Random.Range(((boxCollider.bounds.size.x / 2) * -1) * limitPerAxis, (boxCollider.bounds.size.x / 2) * limitPerAxis); float ypos = Random.Range(((boxCollider.bounds.size.y / 2) * -1) * limitPerAxis, (boxCollider.bounds.size.y / 2) * limitPerAxis); float zpos = (boxCollider.bounds.size.z / 2) * limitPerAxis; createParticle(xpos, ypos, zpos); } // Update is called once per frame void Update () { } public void OnGUI() { } } I've attached some screenshots to show you how the problem looks.  
  2. Adyrhan

    Is hacky code allowed in industry?

     Hacky code is not allowed, but when there are deadlines is tolerated. I think that sums it pretty much.   I'm actually working in a product for a client and from time to time he asks for some more functionalities. It happens that if I would go the safe route and take my time to design proper and clean code, my clients go hunting me constantly asking for progress and they go with a bad feeling about my services. If i do hacky code, I deliver much faster and they say ohh you are very productive, but its obviously a trap not only for them but for myself. What happens is that after two or three updates, code gets messy and difficult to modify and even understand after some time since its writing, you already know the story. What I do now is to clean an even rewrite those hacky lines of code only after delivering even when they dont expect a second release. Its more work for me but with this I get saved from the chaos, they get a free update and the code is ready for being upgraded with more functionality if the client requests it.
  3. Adyrhan

    What about LeadWerks 3?

    What the hell? You're right ! What a stupid mistake I've made. Sorry for the confusion folks :D   Thanks Kirkkaf13!
  4. Adyrhan

    Linking libraries in VS 2012 (Express)

    I'm almost in the same situation as you, coming from a Unix environment to develop games in Windows. If you go to Project > Project Properties > Linker >  Input > Additional libraries, you can specifiy more explicitly which libraries your project needs. That is how I'm getting the linker to properly work. Also you will need to put the directory where those libraries are, either in Linker > Additional library directories or in VC++ Directories > Directories for library search Hope it helps !
  5. Thank you very much for your advices 3Ddreamer. I appreciate it a lot. Very insightful. Also thank you Tutorial Doctor. I'll download the engine you mention and I'll see if I can do something with it.  
  6. I've found this engine searching on the net but there is not enough tutorials and documentation and projects done with it. Do someone have more information about it? Seems their evaluation version has no time limit and I could learn to make games with it. I like the fact that I can code in C++ and in a scripting language like lua, and that it has a GUI editor for the game levels. Do someone have had experience with it?
  7. I guess you are right, if OpenGL has his own story to setup I may use some graphing software, or may be mathematica. is matlab very difficult?
  8. So I'm getting info and books about 3D game programming. I know nothing about 3D graphics programming and I'm doing my maths right now, following the book Game Coding Complete, the chapter 14 "3D Graphics basics - 3D Math 101". But I'd like to get more feedback about the results I'm getting so I was thinking if I could test in some 3D environment what I'm calculating. Using C++ language do you think I should use plain opengl to do it (is glut the library to do opengl programs in c++?) or should I use something else? Thanks!
  9. T   Ooops I don't know how facebook got to be in that link :/ Now is fixed thanks :)   Thanks for your feedback Zaoshi, I'll take note of it. I know the download of boost is not something very pleasant to do, but since my system compiler is gcc 4.6 is not fully c++11, so for unordered_map and for boost::filesystem and some other more I had to use it. I'm a bit afraid of replacing the system compiler (I'm actually using ubuntu linux 12.04 in my dev computer) so I have to either upgrade my linux distro or find a way to have two compilers to coexist in a way that I don't have to alter the build system of the packages I want to compile to use the second one.
  10. Hi guys! After a long time since I don't write c++ code I've recently decided to retake it. So, to learn again and refresh what I already knew I have written (well, rewritten) a new version of a simple file packaging tool that I have and I've decided to release it GPL'd. It's here: https://github.com/16BITBoy/packitup If you feel like to play with some code, please give it a look and tell me what you think and what could I do with it to improve my C++ skills. Thanks and happy hacking
  11. I think I'd like to be developing ai or gameplay, I'm still not sure, I guess I'd better try doing a little of all and then decide. AI and gameplay is what interest me the most, but I know what matters is the experience of the progress, and for that I'd have to try myself.    Thanks
  12. Well I'm not completely new to programming, but never started serious into game development. I played with C++ like 4 years ago, but since almost like 2 years now ( well, a year since I became serious in programming ) I've been programming in Java for Android. Also played with Python, Bash (I use Linux in one of my computers) but as I said, I just made a Pong clone I remember using Allegro and some C++ (well, C code using c++ classes xD) not really knowing very much of what I was doing. I've been digging out info, ebooks and printed books and C++ basics are easy to me, but the long list of common practices and techniques that are used professionally (like what I've asked in other thread about separating interface from implementation - pimpl) are all new to me, so I wasn't coding in C++, may be some other weird thing :D Thanks for your advice !
  13. Thanks all for your advice, I really appreciate it. :D     unordered_map was put in the C++ standard as of C++11. Have you considered migrating to C++11?   Yes, but I'm not doing it yet, but I will very very soon.
  14. Hi,  Its been long since the last time I used C++. Only played a little bit with it but now that I want to become serious in game dev I've decided to retake it.   I'm designing an API for a simple file packer (you know, like a tar file manager) intended to create packages to put game resources into it. This API will be used by the frontends to view, add, delete and extract/access a file from the package. The problem I'm facing is that I don't want the frontends to include the thirdparty dependencies that I needed for the library that has the API. So, I've made the method declarations (the public interface) in a way that only ask for basic types and std objects. But, the implementation has objects that have types that come from the boost library, that makes the "private:" section of the class declaration to have thirdparty library tipes and I don't want to have it, lets say in my Qt frontend to include boost when I should not need it.   I was reading "Effective C++ 2nd Edition" and in "Item 34: Minimize compilation dependencies between files" it says a good way to reduce dependencies is to have 2 physical classes (to name them someway) for each logical class, one to expose the public part of the class, and another with the private part of the class, having the public class a pointer to an object of the private class as a member. Would it help me this to avoid having to include boost in my frontend code? Is there a more simple way to do it? I tried by writting forward declarations but some boost classes (one of them I'm using is unordered_map) have very difficult template declarations with other dependencies in it. Thanks
  15. Hi all! I'm new here and I expect to make friends and learn from you guys   I was reading this article here : http://t-machine.org/index.php/2013/10/21/what-programming-language-should-aspiring-game-developers-learn-in-their-free-time/?utm_content=buffer4611f&utm_source=buffer&utm_medium=twitter&utm_campaign=Buffer   It was quite interesting to me since I want to become serious in game dev and here the author proposes that C++ may not be the game development language that is now. Do you people think the same? Which one else could be? Java, C#, D perhaps? Cheers
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!