Search Unity

Circular Gravity Force

Discussion in 'Assets and Asset Store' started by LaneMax, Dec 13, 2013.

  1. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Update is live! Remember there has been a lot of new changes so BACKUP ALL CODE BEFORE UPDATING.

    Cheers and hope you like the new updates! =)
     
  2. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    Where are the docs for the new version? Am I overlooking them ...?

    (Looks great, BTW!)
     
  3. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Thanks =) I still need to updated the old user manual, I'm hoping to get around to it possibly over the weekend. Until then I would check out the tutorials, I'm also planning on making a lot more videos in the future.
     
  4. nrlnd

    nrlnd

    Joined:
    Mar 13, 2012
    Posts:
    12
    I bought your last gravity circular force. I guess you had to remove the old one on uni 5. Planing any upgrade discount solutions? Im not going to buy it again if i need to buy a new one for each of new unity versions that will arrive. Tight budget : /

    Will the old one show up in my asset account if i go back to 4.6?

    anyway great asset
     
  5. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    If you already bought it once, the new version should show up in your account 4.6 up to 5. Keep in mind to backup the old version if you want to keep the old one.
     
    nrlnd likes this.
  6. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    I am very interested, but I got a question - doe this package include the "Sticky Stick Stuck"??
     
  7. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey bawss =P

    Sticky Stick Stuck is its own package right now, currently SSS is having some problems porting over to Unity 5 because of the physics changes, but it works well in 4. This is going to be my next project on the backlog
     
  8. wayneh654

    wayneh654

    Joined:
    Nov 25, 2012
    Posts:
    15
    Hi. Love the new CircularGravityForce Package. Great work.
    I just wondering at a programming level you don't have anything on class and methods and what they all are. Be keen to have some index of them all and also code samples, eg to change filter tags, turn on or off things, ...

    I am new to coding in C# so any help here will be amazing. Thank you in advanced, Wayne.
     
  9. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Thanks Wayne! I'm hoping, when I get some time, I'd like to setup some video tutorials on just some coding, I'll update you when I do. But for the most part its pretty straight forward to access fields within the cgf gameobject. Here is a quick example script of setting the size and force power of the cgf on start.

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. //Namespace used for CGF
    6. using CircularGravityForce;
    7.  
    8. public class HelloCGF : MonoBehaviour
    9. {
    10.     public CircularGravity cgf;
    11.  
    12.     // Use this for initialization
    13.     void Start()
    14.     {
    15.         //Size of the Cgf
    16.         cgf.Size = 10f;
    17.         //Force Power of the Cgf
    18.         cgf.ForcePower = 50f;
    19.     }
    20.  
    21.     // Update is called once per frame
    22.     void Update()
    23.     {
    24.  
    25.     }
    26. }
    27.  
     
  10. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    New updated incoming!

    Version 3.01 Released
    -- Gizmos Icon Compatibility Update
    -- Add GameObject Filtering
    -- Change Filters to use List not Arrays
    -- Added Shortcut to Wizard window
    -- Add Tutorials to Toolbar
    -- Select Multiple CGF at Once
    -- Add Diagram Scene

    Cheers!
     
    hopeful likes this.
  11. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,145
    This looks really neat but also expensive (to me, at least, because I am poor.) Is there a way to make it if I were creating a vortex in the demo to make pseudo planet-like gravity that I could have it so the gravity is properly affected by the inverse square law?
     
  12. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey Murgilod,

    I'm in the middle of adding a 5 type of gravity as we speak for 'Gravitational Attraction', works better for setting up planets and will be in the next update, so this should be possible in the next few weeks =) I'll update the thread when its live. Here is a screenshot of what is looking like so far.

    Screen Shot 2015-05-14 at 9.26.32 PM.png

    Cheers!
     
    Last edited: May 15, 2015
  13. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,145
    Perfect, thanks! I'll keep my eye on the thread for the time being.
     
  14. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Also getting it working for 2D ;)

    2D.png
     
  15. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey Murgilod,

    New update is currently checked in and being reviews, should be a few days for Unity to approve. Until then you can check out the newest demo builds, I have some planet scenes you might be interested in ;)

    DEMO LINKS: WEB, PC, MAC

    cheers!
     
  16. Jiraiya

    Jiraiya

    Joined:
    May 16, 2013
    Posts:
    12
    Hi, is it possible to raycast along the y axis as opposed to just the x axis?
     
  17. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey Jiraiya,

    Once you create the CGF Raycast object you can rotate or move it in any direction
     
  18. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    New version is out, includes some new planet goodness ;)

    Version 3.05 Released
    -- Added Gravitational Attraction for a Fifth Type Also Supports 2D
    -- Added Planet Scene
    -- Added Planet 2D Scene
    -- Added Hovercraft Scene
    -- Added Align to Force Filtering Options
    -- Updated Tool Classes
    -- Updated Hover Options
    -- Changed SceneSettins.cs to a Singleton
     
    TonanBora likes this.
  19. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hovercraft Tutorial

     
    TonanBora and hopeful like this.
  20. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Planet Tutorial

     
    TonanBora and hopeful like this.
  21. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    TonanBora and hopeful like this.
  22. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    <3 Thank you! :D
     
  23. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    np ;)
     
  24. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
  25. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Hi, I'm testing CFG 3.06 on Unity 5 and there is a huge memory allocation every frame. I have 7 object with gravity force enabled in the scene, and for every frame CGF allocates 9 or 18 KB.
    Looks like that the code keeps calling GetComponent() inside FixedUpdate.
    Thanks
     
  26. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey mcmorry,

    I had some time this morning to mess with it and it looks right, thats is pretty high. From playing with the Menu scene I was seeing it using 46k, after making some changes I got it down to about 3k to 4k. I'll try and push the patch through in the next few days after some more testing, see if I can get it lower. Also one other thing to keep in mind, the more objects you effected with the CGF, the more it will take up, so be sure to manage them wisely by disabling or removing the ones you don't need when playing your scene. I'll keep you updated when the patch is live, thanks again for the heads up =)

    Cheers!
     
  27. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I gave a quick look to the code, and I think that two things could improve it.

    The first is to cache the Rigidbody of the objects, so that in the FixedUpdate you have to add only the missing one. A dictionary could do the job, using the gameobject instance as key and the Rigidbody as value.

    Another thing that help is avoiding any foreach or Linq syntax, and go with the plane and simple for loop. Foreach and Linq allocates a lot of memory, and for mobile applications is not good. Also iOS AOT could create problems with Linq.

    I think that you should be able to reach 0 bytes allocation using cache. It will also have a better performance than calling many times the GetComponent method.
     
    LaneMax and hopeful like this.
  28. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey mcmorry, 3.07 just released with the some dramatically less memory usage, sadly I don't think I'll be able to get away from linq, but I did managed to removed all the GetComponent, along with a place holder for all rigidbodys used. Next on my backlog is to start pooling the rigidbodys so it can even use less memory, thanks again for your suggestions =)
     
    Last edited: Jun 17, 2015
    hopeful likes this.
  29. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thank you very much for your support.
    If you don't mind I'll give a look to the Linq parts and I'll check how much memory it requires. I'll try to remove the use of Linq at least in the FixedUpdate and if I'll be successful I'll send you the changes.
     
    hopeful likes this.
  30. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Go for it, let me know how it goes =)
     
  31. kartast222

    kartast222

    Joined:
    Mar 10, 2014
    Posts:
    1
    Hi LaneMax,

    I would like to create magnet like behaviour. Right now I use the sphere with negative force at position, however the bodies will continue to oscillate once it overshoot the center. How can I create a magnet like behaviour where other bodies get attracted to the center and stays at the center without overshooting?

    Thanks
     
  32. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey Kartast,

    So when an object reaches the center do you just want it to instantly stop?
     
  33. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Hi LaneMax.

    I tried a car tutorial. How should it be done to increase the speed more?
    I set the vertical value to 200, but it doesn't change so much...
     
  34. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey frontakk,

    Try playing with the "Force Type Properties->Torque Max Angular Velocity" setting
     
  35. g0tNoodles

    g0tNoodles

    Joined:
    Nov 28, 2010
    Posts:
    193
    Hello,

    I am looking on buying this but just wanted to make sure of something before I did. I am sure this can be done but I would like to have an idea of how easily.... I would like to have a 2/2.5D game where a ball is simply bouncing up and down but is affected by gravity. For instance (and making it easy), if the gravity is set to 1 the ball will bounce 10 units. as time goes on the gravity will increase and the balls bounce height will get less and less due to the increased gravity (essentially the numbers reversed).
     
  36. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    217
    Cool asset. I'm wondering how well it works on mobile. Glad to see you have 2D stuff working now.

    I've been working on a game that involves creating planets and dynamically changing gravity fields in 2D for mobile. Figured I might be able to use your asset to improve upon it. (You can check out an older versions here: http://www.Stexe.com/GGGW/Web.html)
     
  37. andrewjason

    andrewjason

    Joined:
    Oct 17, 2013
    Posts:
    24
    Hi, I'm thinking about buying this today to prototype a game I've been drawing up in my head for some time. I just have one quick question- how well does AI/mecanim work with the 3d planet gravity?
     
  38. dleight

    dleight

    Joined:
    Jan 28, 2014
    Posts:
    7
    I'm also interested in this asset and wondering how it works on mobile.
     
  39. FfZ

    FfZ

    Joined:
    May 22, 2013
    Posts:
    1
    Hi there, I'm creating a physics style game like this:


    Would I be able to manipulate the physics using your asset to keep the players upright, i.e., constantly bouncing back to an upright pose... not a fixed upright though, I still want the fun of the physics.
     
  40. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hello Stexe, and dleight

    I've used CGF for my game bubbleinferno.com game and seemed to work pretty well, also in the trailer I have the mainmenu scene running on a iOS, which is pretty physics intensive, and runs pretty smooth. You will need to make sure that you manage the CGFs well on the mobile side, meaning disable them if your not using them.
     
    Stexe likes this.
  41. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Yeah this is possible, although you might have to pop into some code to accomplish this, sense this is very specific how you want the ball to act.
     
  42. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    I haven't messed to much with the Unity's AI, but I'm guessing sense this is all very dynamic, because its all physics based, you will have to make your own rules around around how you want those reactions to be.
     
  43. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    You can, but only using a planet setup... I'm exploring the possibility for more options later down the road.
     
  44. andrewjason

    andrewjason

    Joined:
    Oct 17, 2013
    Posts:
    24
    Thanks for your reply, I have purchased CGF, and will play around with implementing this, I will probably post any solutions I find as simple or as complex as they may be in this thread, at some point :)
     
  45. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Cool thanks!
     
  46. lyndontroy

    lyndontroy

    Joined:
    Dec 12, 2012
    Posts:
    31
    How can I add gravity inside a clear sphere that allows my character to run inside the bubble sphere, while being able to see through to outside space?
     
  47. lyndontroy

    lyndontroy

    Joined:
    Dec 12, 2012
    Posts:
    31
    Where are the manuals?
     
  48. lyndontroy

    lyndontroy

    Joined:
    Dec 12, 2012
    Posts:
    31
    Are the physics standard Newtonian physics? I need gravity to behave differently according to mass and element types. A dense star reacts differently on light and solid objects than a large sized sun. Is the source code available?
     
  49. pauldrummond

    pauldrummond

    Joined:
    Oct 30, 2014
    Posts:
    145
    I just bought a license for CGF as it looks like it will help with a project. However, is it possible to change the 'align to force' option so that objects are flipped along this axis? To illustrate, I need to simulate moving around inside a large structure which is spinning to produce centrifugal force, or spin-g. I can create a CGF object which uses a capsule, then place my cylinder geometry inside this. Filtering allows my player controller to be affected by the CFG, getting pushed out, or down, to the floor of the spinning structure. However, they're pointing the wrong way with the head downwards. Can they be flipped along the align axis so 'up' is back towards the centre of the CGF object? Hopefully this illustration makes things clearer:



    Any help is much appreciated.
     
  50. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey pauldrummond,

    Thanks for the diagram, and i think you should be able to flip the axis, you will have to jump into some code in the circulargravity.cs file under line: 1080 and change it from

    Code (CSharp):
    1. Vector3 localUp = item.transform.up;
    to this

    Code (CSharp):
    1. Vector3 localUp = -item.transform.up;
    I think in the next update i might just add this option so you can just pick the direction you want the objects to align to. Let me know if this works

    Cheers!