hi, i want to do a simple simulation of the movement of a rocket (small rocket launched by water compression).
I figured out how to move it like a parabola (ActionScript) :
var pasx = 0.1;
var p=-200;
var h=200;
var k=100;
function Update () {
transform.position.x+=pasx;
transform.position.y=(transform.position.x-h)(transform.position.x-h)/(4p)+k;
transform.Rotate(new Vector3(-0.4,0.05,0));
}
Is there a better way to do this ? I’m new to unity, i see i uses vectors and directions and stuff, maybe there is a script that allows me to give a first push to the rocket, and it flies by itself…
I would say that I hate to be overly technical, but that is a lie.
The initial add force wouldn’t quite give the desired effect from your post, but it would create a parabolic flight path.
Your water rocket would actually apply a declining force over time as the air pressure in the rocket approaches parity with the ambient air pressure. That’s a bit harder to code and you’d probably want to use FixedUpdate for that to improve the results’ consistency, but you would basically apply force each FixedUpdate, but reduce the force on each FixedUpdate based on the size of the nozzle used and the water/air mass inside the confined space of the bottle.
If that’s more detail than you actually needed, a singular RigidBody.addForce would suffice. However, you did say simulation.
yes i want to do a real simulation ! and it’s the first time i use unity so i’m really thankful for yr help
I see what u mean, i’ll try to do that : apply a force in a fixedUpdate, this force takes a Vector3 as parameter, and this Vector3 decreases in value over time (depending on the mass of the rocket and the pressure of water…)
i’ll check if i need to apply both a starting force and a fixed one (i’ll ask someone i know who makes these rockets)
thx a lot !