- Home /
2D Topdown deteriorating orbit?
I have 2 seperate gameobjects, and am trying to implement some sort of catch and orbit.. essentially when object A hits object B's circle collider trigger, I want object A to start orbiting B in a shrinking spiral.. Essentially moving on the x/y plane like it was trapped by gravity. I keep trying methods using Transform.lookat and Transform.rotatearound, but it never seems to give me a 2d orbit like this. Kind of like an object falling into a whirlpool if your looking straight down at it. Any suggestions?
It would be nice to use physics2d since Im already adding force until it collides.. then im just setting its velocity to 0 for now..
Do i need to change it and make it a child of the object to orbit in c# to properly orbit around it?
Been at it for a few hours and drawing blanks..
Answer by robhuhn · Apr 11, 2014 at 08:21 AM
There is a script for orbital gravity. For a shrinking spiral object A would need to have a specific initial velocity vector. http://wiki.unity3d.com/index.php/Gravity
And there is also another script I never tried but "Simple planetary orbits" sounds like it could fit your needs. http://wiki.unity3d.com/index.php/Simple_planetary_orbits
appreciate the links.. thats kind of what I was doing already, it just kept wanting to rotate on the Z axis and was killing me..
Your answer
Follow this Question
Related Questions
Smooth transition for RotateAround 1 Answer
Triying to make a character take knockback in a parabolic motion in 2D. 0 Answers
While Moving Left or Right my character falls more slowly. 2 Answers
How to orbit UI object depending on another gameobject position (2D) 1 Answer
(2D) Creating a border around the game 4 Answers