We generally teach students to use either the gerund (ING) or the "to infinitive" in this case. What you're doing is using the verb 'set' but you're really talking about an action, as an idea rather than a reality. (I want {want being the real action} to break free {break free being the idea).
Basically the gerund talks about the idea of the situation (swimming is everything speaker associates with the verb swim, like pools, wetness, and any other), while the 'to infinitive ' talks about the idea of the action (the idea of actually swimming in its actionable sense).
In your example you can make a choice as well. "the first thing that needs to be done is setting the trajectory". But that won't be your instinct, as you obviously speak of actually doing the action in your example. Because you rather use the situation the action represents, you should use TO, but realise that even if people don't tend to use one or the other in specific situations, you always have a choice if you have to express an idea specifically.