Search Unity

[Released] 2D Gravity Kit

Discussion in 'Assets and Asset Store' started by dude4004, Dec 14, 2016.

  1. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181


    Hi,

    I am currently working on this project which make the character walk on Planets/Platforms of any shapes.
    Check out this demo

    Work on every shapes
    Characters with different size work well on it


    Also, can make some awesome bigs planets (even clouds rotate on differents speed)


    Ideas
    - If you have some ideas about this project, please post here OR send a email to volkov40@hotmail.com and I will glady add it to the projects.

    Best regards,
     
    Last edited: Dec 17, 2016
  2. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    This would also be great if in certain cases the object rotated, but character stayed in same place.
     
  3. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Can you explain a little more?

    Best regards,
     
  4. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Update many features.

    - Characters can now start on any angle on the planet
    - Characters can now Jump
    - Created Sample 2 which is a big planets showing how powerfull this can be :)

    Anyone interested?

    Best regards,
     
  5. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Just made a video showing this package!


    Enjoy!
     
  6. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    It has been sent to the Asset Store so now it's in Pending.
    All you have to do is waiting to be available on the store!

    Also, just updated the demo with the last version.

    Best regards,
     
  7. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Very nice. Good idea !
    Can a character jump to another near planet ?
    6R
     
  8. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Not yet, but it will definitely be in the next patch :)
     
  9. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    There you go. Just finished coding the option on the character to be able to change planets when jumping.
    You must be nearby and jump.

    Check out this demo

    Best regards,
     
  10. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Just created a Sample 3 which show how you can create planets around other planets and use them to move between them. Also each planet has their own Clouds, Gravity.
    Add some rotation to make it harder for the player to walk between them.
     
  11. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    I decided to add Projectile in this project which mean, the player will be able to shoot with a gun and the projectile will use this gravity and hit the other character on the other side of the planets.

    Sounds a good idea? I'll post a update when it's done
     
    zircher likes this.
  12. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Just updated again with many new features !

    Demo

    - Now planets can be Increased/Decreased when jumping on a switch. Also, everything on the planets keep their own scale and they get back to position. When increasing/decreasing, the appropriate sound is played.


    - Also, coded Projectile when pressing SPACE. The Projectile will be created on the same direction of the character and will follow until it dissapear. In another patch, it will collide with enemy character which will be destroyed. Also, there will have Spawner who will create enemy character until you destroy it. (VERY SOON)


    Leave a post if you want any new features.

    What's coming next?
    - Changing gravity between planets
    - Creating zone which will use 2D Gravity & Normal Gravity (Up/Down). Ex : Your outside a space shuttle and you enter it, you will now be walking normally. Not on wall or roof. Then you go back outside, then you can walk anywhere on the ships.
    - Objects 2D Gravity (Crates, Jar... ) When changing gravity, the object can rotate itself and be on the top or right side. Characters are always on their 2x legs.
    - Many enemys which will make the game better (Enemy Ships, Enemy Probes)
    - Advanced Projectiles (Missile, Arrow using the Bezier curve)

    Best regards,
     
  13. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Hello there,

    Demo has been updated again with new samples to be tested.
    I've been working busy on this project and here is the latest patch so far!

    I've done Teleport between Planet which mean also the Projectile are being teleported and killing stuff on the other side.


    Also, it can teleport the character in the right gravity side. Even if the planet is rotating..


    I added Impact on the projectile when hurting Plateform OR Walls which is not on the same planet.


    I also created a new function for the Switch which change the gravity of all the childs on a planet on a new one.


     
  14. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Hello,

    The package is now available on Unity Store
    The latest patch is on it's way so you can have features as the Demo!

    If you have any request, feel free to post in this forum or send me a email to volkov40@hotmail.com.

    best regards,
     
  15. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
  16. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    Here is the new update coming to the asset store!

    There are now 2x type of projectile.
    Bullets and Missiles. Bullet will follow planet gravity and go around it.
    Missile are different. They will go where you aim it and explode killing hostile NPC.


    Also, the crates can now be pushed in the teleport.
     
  17. VanDarkholm

    VanDarkholm

    Joined:
    Jun 5, 2017
    Posts:
    1
    Hi, I was working with your asset and noticed that the player's sprite is missing. When I add the sprite, the player just dropped infinitely in the space. For now, I can only change a character comes with the planet to a normal player, but the sprite is still in "enemy" form no matter how many times I change it. Can you provide a detailed description on what components a character needs? Thanks!
     
  18. dude4004

    dude4004

    Joined:
    Jul 15, 2014
    Posts:
    181
    When you launch the default scene, the player start and fall ?
    Did you try to delete the whole folder and download the project again?

    Because on my side, the player has the sprite.

    If this doesn't work, send me a printscreen showing the character script.
    Here is the default one here
     
  19. haywirephoenix

    haywirephoenix

    Joined:
    May 17, 2017
    Posts:
    109
    Hi, I recently purchased 2d gravity kit, it's great! I'm testing performance and it can cause quite large framerate drops when using many instances. This is where I'm at so far with optimisation and wondering if you have any advice.
    • Removed rigidbody
    • Removed collider
    • Enabled gpu instancing on Material
    • Commented out all of the Debug.drawray lines, and the checks for mouse position (they don't use weapons)
    • Moved everything in FixedUpdate into a function called CheckPosition()
    In FixedUpdate I'm just doing:

    if (vCurPlanet == null || !Grounded)
    CheckPosition();


    Grounded = true is currently being set next to vFoundGround = true (~line 408?) I don't think this is the right place for it to go as they no longer complete their full rotation before stopping.

    I only really need to update their rotation if they decide to move (wander). They also don't need to jump planets. My thinking is that once they know their position and rotation relative to the planet, they don't need to constantly update. Are you able to point me to where they should be set to fully grounded and do you have any ideas on further optimisation?

    Any advice would be fantastic. Looking forward to hearing from you!
     
    Last edited: Sep 24, 2018
  20. haywirephoenix

    haywirephoenix

    Joined:
    May 17, 2017
    Posts:
    109
    Can you provide an update or example for using this in the new entity component and job system?