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
    ONLINE DOCUMENTATION

    Circular Gravity Force allows you to easily manipulate physics in Unity 3D with no code required.

    DEMOS: PC & MAC

    CGF 5 Features Include:
    - Full 3D/2D Support
    - Four Different Physics Shapes: Sphere, Box, Capsule, and Raycast
    - Six Different Force Types: Force at Point, Force, Torque, Explosion Force, Gravitational Attraction, Velocity, and Angular Velocity
    - Five Different Force Modes: Force, Impulse, Velocity Change, Acceleration, Lerp Velocity
    - Emit Force from Closest Collider allowing you to pick the shape of the force.
    - Velocity Damping and Angular Velocity Damping
    - Effects Like Align to Force and No Gravity
    - Non-Alloc Physics Support
    - Version 5 Demo Scenes MainMenu, Car v2, Hovercraft v2, Marble
    - Version 1-4 Demo Scenes Car, Car 2D, FPS, Hand, Hovercraft, Menu, Pinart, Planets, Planets 2D, Rocket, Rocket 2D, Vortex, Vortex 2D, Homing, and Pivot.
    - GameObject, Tag, Layer, and Bounds, and Physical Materials filtering
    - Events/SendMessage Avalible for CGF
    - High Performance and Low Memory
    - Fully Customized GUI, Gizmos, and Handles for CGF objects
    - Full Source Code
    - No DLLs

    CGF makes it incredibly easy to create and invent cars, rockets, explosions, cannons, magnets, vortexes, hovercars, planets... the possibilities are endless! The demo's and tutorials show just how easy and powerful this package can be.

    OTHER LINKS:
    Discord
    Unity Forum
    Manual
    CGF Website
    Resurgam Studios
     
    Last edited: Dec 29, 2020
    EliasMasche likes this.
  2. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    You should post a link to this thread in the asset store.
     
  3. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
  4. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    New v2.5 is out, includes editor tool :D
     
  5. glunity

    glunity

    Joined:
    Jun 19, 2014
    Posts:
    23
    Hi Lane.
    Your assert, not run the gravity force to the unite's particles !
    nor cloth.

    The rest is a good assert. Can You upgrade this to all objects in unity ?

    Sorry my bad english.

    Thanks :)
     
  6. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    1,027
    I believe that Particles have their own Gravity setting, Im not sure that this script would be able to effect that....I could be totally wrong though.
     
  7. glunity

    glunity

    Joined:
    Jun 19, 2014
    Posts:
    23
    Thanks, John, no is possible that I had working with it.

    The assert is a good work, but as I am very new in unity3d I am very confused with all.

    By example, I buyed a assert to see a fantastic visual effect, but run with the pro version :p
    I suposse that I will try in the future, when I buy the pro version... ESO ESPERO !


    In my "knowledge" I suposse that the particles are objects similar to the rest in gravity resources.

    I am now find a particles generator that able make objects, to join the both assert with my necessities.

    I am now seen this two:
    particle dynamic magic
    https://www.assetstore.unity3d.com/en/#!/content/16175

    and

    particle playground
    https://www.assetstore.unity3d.com/en/#!/content/13325

    -sorry my bad english-

    Thanks for you repply
     
  8. dabaq

    dabaq

    Joined:
    Apr 20, 2014
    Posts:
    14
    Does this work with 2D objects?
     
  9. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Sadly still no 2D settings, I'm still waiting on Unity to update some of there physics functions, I'm hoping this will be added in Unity 5.0. You can use the 3D gravity and constrict the the z axis for a work around.
     
  10. LaneMax

    LaneMax

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

    Sorry for the late response, JohnRossitter is correct, you can only use this with objects that have a 3D rigidbody. I would agree that what you might be looking for is the Partical Playground, never tried it, but it looks cool.
     
    JohnRossitter likes this.
  11. staincorb

    staincorb

    Joined:
    Mar 30, 2009
    Posts:
    123
    Quick question I know I can ad spherical gravity to an object, and move it around with controls. is it also posible to have other gravity object pull in that same object ?

    Also is it posible to use this in 2D ? say I just want gravity to be afected in Y and X coordinates but not Z ?

    Nice tool any how, im probably going to get it, Congrats
     
  12. LaneMax

    LaneMax

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

    Yeah you can use as many gravity objects as you want, but keep performance in mind. Sadly still no 2D settings, I'm still waiting on Unity to update some of there physics functions, I'm hoping this will be added in Unity 5.0. You can use the 3D gravity and constrict the the z axis for a work around.
     
  13. staincorb

    staincorb

    Joined:
    Mar 30, 2009
    Posts:
    123
    Ok thanx for the answer.
     
  14. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Hey Lane!
    I downloaded the Sample Assets pack that Unity released, and came across the roller ball scene.
    I then started wondering if I could create a Planet with your Circular Gravity that you could roll around on.
    Is this possible to do?
    At the moment, the player ball gets forced to the closest gravity point, and can no longer move.
     
  15. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey TonaBora, don't know if that would work. you might try adding friction to the ball material and see if that does anything.
     
  16. zreese

    zreese

    Joined:
    Dec 23, 2014
    Posts:
    1
    This looks really cool. Quick question: is there a way to have the gravity force raycasting be (easily) stopped by walls or other object types?
     
  17. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Sure try this out:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. //CircularGravityForce Asset
    5. using CircularGravityForce;
    6.  
    7. public class RaycastLimiter : MonoBehaviour
    8. {
    9.     //Place your CircularGravity object here
    10.     public CircularGravity cgf;
    11.  
    12.     //Offset of the Raycast, if needed
    13.     public float offsetRaycast = 1f;
    14.  
    15.     //Max distance
    16.     public float maxDistance = 1000f;
    17.  
    18.     //Debug Raycast
    19.     public bool drawRay = true;
    20.  
    21.     // Use this for initialization
    22.     void Start ()
    23.     {
    24.  
    25.     }
    26.  
    27.     // Update is called once per frame
    28.     void Update ()
    29.     {
    30.         Vector3 fwd = this.transform.TransformDirection(Vector3.forward);
    31.      
    32.         RaycastHit hitInfo;
    33.      
    34.         if (Physics.Raycast(this.transform.position, fwd, out hitInfo))
    35.         {
    36.             cgf.size = hitInfo.distance + offsetRaycast;
    37.         }
    38.         else
    39.         {
    40.             cgf.size = maxDistance;
    41.         }
    42.      
    43.         if(drawRay)
    44.         {
    45.             Debug.DrawRay(this.transform.position, fwd * cgf.size, Color.red);
    46.         }
    47.     }
    48. }
    Also here is a quick demo on GitHub, you'll need the to install the Circular Gravity Force asset once you have opened the Unity project to get the demo scene to work. Let me know if this helps. Cheers!

    GitHub Link: https://github.com/Resurgamstudios/CGF_Raycast_Limiter_Demo
     
  18. timothyallan

    timothyallan

    Joined:
    May 22, 2013
    Posts:
    72
    Soooo, I've got an object moving towards a sphere, much like your planet demo. However, when it gets close to the sphere, the rotation of the object goes all bananas. I noticed that you're using AddExplosiveForce for the application of force, which I assume is what is causing the rotation force, is there any plan for an update that will use AddForce instead so the object being affected doesn't get blown all over rotationally? I can't use AlignToForce either as it's too sudden.

    Edit: you'll notice that the bullets in your planet demo also exhibit the rotation once they hit gravity.
     
  19. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    I'm hoping to re-evaluate more functionality around some of the planet stuff when I get some extra time, maybe even adding more force control options for when trying to simulate planet gravity. I'll keep you updated
     
  20. timothyallan

    timothyallan

    Joined:
    May 22, 2013
    Posts:
    72
    Okay cool. I ended up rolling my own, but it lacks the cool visualizations of yours :) I'll keep an eye out for updates though!
     
  21. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Working on a massive update, hoping to have it finished my the end of the month... its going to open up a whole new world =D
     
    hopeful and OnePxl like this.
  22. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Sounds interesting, would you like to give us a sneak peek?
     
  23. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Sure =), a small part of it is CircularGravity2D.cs
     
    LaneFox likes this.
  24. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Hey there LaneMax!
    Since Unity 5 had to go and update their physics system, your Circular Gravity is no longer compatible. :-(
    I am wondering if you will be updating your fantastic creation at some point to be compatible with Unity 5. *crosses fingers*

    Or is this part of the big update you are talking about? o_O
     
  25. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    It should still work fine and run even better in Unity 5, you do have to re-import the asset in the Unity 5 project and run the "API Update Required" and click the "I Made a Backup, Go Ahead!" button. Let me know if you still run into a problem.

    But yes the next update is going to be pretty crazy ;)
     
  26. glunity

    glunity

    Joined:
    Jun 19, 2014
    Posts:
    23
    Hola LaneMax.
    I am circular gravity user, and need use your assert with "interactive cloth".
    How can I get atracted with a circular gravity ?
    I am running in 4.6.3f1

    Thanks.
     
  27. LaneMax

    LaneMax

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

    I dont think my content works for interactive cloth sadly, unless the interactive cloth uses a rigidbody component.
     
  28. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Hey Lane, here is a picture of the errors I get when importing Circular Gravity into my project.
     

    Attached Files:

  29. LaneMax

    LaneMax

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

    When importing into Unity 5, did you do the API convert? I attached a screenshot of what it looks like
     

    Attached Files:

  30. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    I upgraded my whole project when I tried to open it with Unity 5.
    It also pops up that window when ever I try to open my project, every single time.
    But when I re imported it (by removing the files and importing it through the asset store), that window did not pop up.
     
  31. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Weird, it should show the convert window. You could try making a new project and try importing through the asset store within Unity see if that works. If not send me a personal message through the forum and I'll email you a converted version for 5.
     
  32. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    CGF3 Sneak Peek ;)
     

    Attached Files:

    TonanBora, OnePxl and hopeful like this.
  33. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Oh, new gizmos! :D
     
  34. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Another peek... Finally finished all new demos scenes today for cgf3. Getting so close of finishing the update :)

    cgf_fps.png
     
    hopeful likes this.
  35. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Sorry for the wait, but getting very close. But its going to be well worth it ;)

    cgf3.png
     
    Last edited: Apr 29, 2015
    hopeful likes this.
  36. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    hi
    can i ask, how do you stop an object (im using the circular gravity script) being effected by the gravitational force temporarily? i tried setting the 'tags' option and then changing the objects tag mid game as and when needed but it still gets effected, its only when the tag is different as the game starts does that work, which isnt what i need...any suggestions?

    many thanks.
     
  37. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey super-cypher,

    You should be to add the tag, and select 'Dont Effect Listed Tags', let me know if that works

    Cheers

    Screen Shot 2015-04-29 at 7.12.34 AM.png
     
  38. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    Hi

    Yes i tried that but it doesn't work as i need it. I need the object to be affected by the gravity then mid game stop the effect for some time then have the gravity affect it again as and when i need it.

    The option to filter tags only works for me when you change the tag on an object (to a filtered tag) 'before' you start the game, i need to be able to change the tag of the object (to a filtered tag) for it to stop the effect on it 'mid game' then change back the tag to one that does get affected when i need it (should it do this?). But as it is now, if mid game i change the tag to a filtered one it doesn't work and the object still gets affected by the gravity (even though it now has a filtered tag).

    hope that makes sense.
     
  39. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hmmm it should filter at runtime if I understand you correctly. How are you changing the tag name when in mid game? Also are you sure that the tag is being set to the gameobject that has the rigidbody? I would run a test where when you do change the tag in mid-game, pause the game, and select that gameobject and see what the tag name is.
     
  40. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    yes ive tried that and the tag is deffinitely being changed, i already checked that by pausing the game, but the effect still gets to it. Im using unity 5 by the way, dont suppose that would make any difference as everything seems to be working ok?
     
  41. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Seems like its working fine in Unity 5, can you send me a message to avenue.lane@gmail.com and we can walk through it?
     
    Last edited: Apr 30, 2015
  42. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    hi
    so sorry man, i was forgetting about the velocity of the object, it made it look like it was still being pulled by the gravity, but it wasn't. All working now! ;)

    cheers.
     
  43. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Cool no worries =) glad its working
     
  44. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194


    Finally in the review process :D enjoy!
     
    OnePxl likes this.
  45. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    WOW!! the new version 3 is really amazing and awesome!! I already was in love with this great and excellent asset and I think that after seeing the version 3 trailer, I even love it much more, and happy that I have bought it already.

    Thanks very much for making this very useful, well done and great asset, like it very much
     
  46. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    That video gives the plugin some high quality visualizations. :)
     
  47. toddheilmann

    toddheilmann

    Joined:
    Dec 25, 2013
    Posts:
    13
    Hi @LaneMax, had CGF in my wishlist for awhile and version 3 looks like incredible!..umm will the asset price increase with the release of CGF3? Thanks! Todd..(sorry if this has already been covered).
     
  48. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Hey Todd I would definitely recommend getting it now because the update hits. Version 3 is currently in the review process now, but when it comes out the price will go up.
     
  49. toddheilmann

    toddheilmann

    Joined:
    Dec 25, 2013
    Posts:
    13
    Thanks for the headsup! Price should go up for what the package offers :)
     
  50. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    194
    Thanks, I'm really excited to see what doors this newest update opens up.