- Home /
Problems making a glider
Hello, I have problems to realize my glider. In fact, I do not use the normal gravity of the rigibodies but an artificial gravity around a planet.
Gravity is a force of 10 that attracts the glider to the ground. It runs automatically to be at least horizontal with the ground.
I wish the glider performs circles smaller and smaller until it touches the ground.
Exemple:
I tried many ways to do this:
A force that will cancel the attraction of the soil gravity (if the anti gravity force is 10 -> no gravity)
A force that is going to move forward
A max speed to clamp the rigibody's velocity
Example of the closest thing I get with this method (I use trail renderer to render the path):
I don't want the square look, I think it is because of the max speed value... So I've tested without it and decrease the anti-gravity so it become real gravity and I get a better looking circle:
The problem here is that the glider need to be really fast and it fall also really fast...
Any idea of how to get something more like what I want???
Cordially.
you can increase the strength of gravity, which should allow it to capture fast moving objects. http://docs.unity3d.com/ScriptReference/Physics-gravity.html
This will still be a balancing act, to fast a glider, and the planet won't be able to capture it, too slow and it will impact before making even a single orbit. Then again, this is just the nature of orbital mechanics.
Hmm, perhaps, if you have only one glider at a time, you could try to base the value of gravity, on the glider's initial speed.
Yeah, I am currently looking for something to do with an adaptative anti-gravity so the gravity at the beginning is normal and it increase with time and with the distance maybe between the glider and the planet... But I have difficulty with this whay that's why I am posting here.
of course, THAT is how orbits work- I missed that in my previous post.
Force Gravity = $$anonymous$$ass1 $$anonymous$$ass2 G / distance^2 (G is the strength of gravity)
You can use this formula, and the AddForce() function (rather than the constant unity gravity), to move your glider. something like this:
glider.AddForce(glider.mass*planet.mass*gravityStrength/ (glider.position-planet.position).Sqr$$anonymous$$agnitude())
Answer by VSuper · Feb 08, 2015 at 06:33 PM
I find out how to do it, it was really simple:
rigidbody.MovePosition (rigidbody.position + transform.forward * (Time.deltaTime * wingsuitSpeedFwd));
rigidbody.AddForce (transform.up * wingsuitGravity);
Instead of moving using force, I use MovePosition, it's also easier to controll the object and it has a perfect movement for my game.
Thanks for your help.
Yeah, but only for the gravity, it for cancel the actual gravity.
Answer by daneislazy · Feb 08, 2015 at 04:40 PM
Are you also having issues with the rotation of the object? I would guess so since that would be something you have to program in manually. But anyways, yea that kind of thing is tricky to do since you are trying to replicate aerodynamic lift and that's complicated as it is, or you're trying to do orbital calculus and that's just silly hard.
If you want the gliding speed/orbit to be pretty constant you can do some Maths to figure out how fast to be going or something. Circumference of a circle is 2pi*r, so maybe get the distance to the planet and do some math and apply some force. (I dunno, just brainstorming)
But that might even be too much work, try turning off the gravity for the glider. Then change the angle of the object to 1-5 degrees off of perpendicular with the planet's surface, then move it locally forward with transform.position += transform.forward * somescalefactor;
. That's going completely around the physics, though.
Ok I see... But I don't have any problem with the rotation of the object, It is always horizontal to the planet's soil. I will try your ways soon I think. Thanks.
Answer by Soiltest · Apr 14, 2015 at 03:51 PM
Is it accurate to say that you are additionally having issues with the revolution of the item? I would figure so since that would be something you need to program in physically. Be that as it may anyways, yea that sort of thing is precarious to do since you are attempting to imitate flight optimized lift and that is convoluted as it may be, or you're attempting to do orbital analytics and that is just senseless hard.
In the event that you need the skimming velocity/circle to be really steady you can do a few Maths to make sense of how quick to be going or something. Periphery of a circle is 2pi*r, so perhaps get the separation Soil and Plant Nutrients to the planet and do some math and apply some power. (I dunno, simply conceptualizing)
Yet that may even be an excess of work, have a go at killing the gravity for the lightweight plane. At that point change the edge of the item to 1-5 degrees off of opposite with the planet's surface, then accelerate it by regional standards with transform.position += transform.forward * somescalefactor;. That is going totally around the physical science, however.