- Home /
Hot air balloon carrying a crate ?
Suggestions on modeling the physics objects for a hot air balloon carrying a crate ?
I am not concerned about the string. Idea being is if the character hits the crate the balloon tilts and floats slightly astray, but if they hit the balloon it pops and the crate falls...
I have tried all kinds of parent -> child relationships with varying types of spring joints etc....
You say you've tried all kinds of things. What was wrong with the things you tried? What exactly have you tried? Overall, making a balloon carrying a crate seems quite simple, so I'm just curious to see why it hasn't worked out for you.
Yeah, it would be really cool if you could list the things you have tried and why they did not work. I once implemented a hovercraft that took millions of tests before it worked; and I am interested to compare alternatives. (I rolled out my own spring-damper system...that was before I really knew about joints, so I don't offer it as a possible answer... but you could get the gist of it from these:
http://answers.unity3d.com/questions/26554/how-do-i-calculate-a-corrective-torque-to-remove-r.html
http://answers.unity3d.com/questions/27418/follow-a-curve-using-physics-or-transform-manipula.html
A balloon should be slightly easier, since you don't have to worry about the direction in which it is facing.
the biggest issue is that I am probably looking for a stylistic change. The issue i have is that mainly the crate gets all crazy, as in crate moves one way, balloon moves other.
I have tried them both being rigidbodies, a combination of joints with limit forces on them.
The look and feel I was ai$$anonymous$$g for is that when the character hits the crate on the side the balloon gets pulled along and drifts to a stop in a pendulum like motion.
Answer by Jeston · Jul 25, 2011 at 09:05 PM
So in the end my physics methods were correct, there is a bug with recursively turning off nodes that blasts my physics objects for some reason.
The physics model I ended up using: Crate is a rigidbody with a hinge joint connected to the balloon. The balloon has same mass but a constant up force and the two objects are sibling objects. The balloon has an increased drag and angular drag and they both use gravity.
Now here is the unity bug: If they are both childed to GameObject A, and I do A.setActiveRecursive(false), then turn it back on later with A.setActiveRecursive(true)...
Then the physics gets completely blasted. This is a hard deal for me to figure out as I have tons of objects on different level nodes that get recursively shut down and turned back on.
When I say physics gets blasted I refer to things like the balloon appears 1000 units to the right, and the crate is at world 0 jiggling back and forth, and other symptoms. The references on the joint are still correct, but they seem to be ignored. However, if I don't turn them on or off, it works fine. Ugh...
It's really a physics bug: if you have a baloon joint to the crate, when setting active the baloon appears during one frame and in the next it goes to God-knows-where. It seems Unity assign the negative of the jointed object coordinates to the baloon. I'll report this bug to Unity.
Answer by aldonaletto · Jul 22, 2011 at 08:49 PM
Provided you have some joint between both, you can simulate a baloon physics with the following:
var massCrate: float = 1; // adjust for the crate mass, if needed
function FixedUpdate(){
rigidbody.AddForce(-Physics.gravity * (rigidbody.mass+massCrate));
}
This will keep the baloon and the crate at a stable condition. If you kill the crate, the force will become too excessive and the baloon will fly. If you kill the baloon, the crate will fall since nothing more sustains it.
You may have to tweak the baloon mass to make it go up reasonably slowly when the crate is killed - the most massive, the slower it will go up.
If you use a fixed joint between the crate and the baloon, the behaviour is what you're expecting: when the crate is touched, both start to move with a little pendular movement. $$anonymous$$aybe adjusting drag you can make them stop after a few oscillations.
Hello, this is an old question, i'm hoping you gonna read :)
Using your techinque, how can i include drag into the formula? Because it works with zero drag on all objects, but i need a little drag because some object will be blown by the wind. If i add drag to one of them they all go down.
Rigidbody.drag doesn't do what you want: it just emulates friction, slowing down rigidbodies when they are moving. If you want to drag them with the wind, you must apply a force in the wind direction - and set Rigidbody.drag just to limit the velocity: the bigger the drag, the lower will be the "ter$$anonymous$$al velocity" (the velocity where the applied force equals friction).
Your answer
![](https://koobas.hobune.stream/wayback/20220612153307im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
help me blow my balloon.... 1 Answer
Balloon-like joint system? 1 Answer
Center of mass (or center of pull) 2 Answers
Hover spring in local gravity 0 Answers
2D 360 degress platformer example needed 0 Answers