- Home /
Flying movement
I am currently working on a flight type game where the user can adjust yaw, and roll (much like a single stick airplane). my initial implementation was using:
void Update(){
...
transform.position += transform.forward*currentFowardSpeed; // currentFowradSpeed:float
float yAxisInput = Input.GetAxisRaw("Vertical");
float xAxisInput = -Input.GetAxisRaw("Horizontal");
transform.Rotate(new Vector3(1,0,0), yAxisInput * rotSpeed);
transform.Rotate(new Vector3(0,0,1), xAxisInput * rotSpeed);
...
}
but this does not actually utilize the RigidBody used for collisions/triggers effectively, and maintains turning radius regardless of the speed the craft is going at. what I want to do is something like:
void Update(){
...
yAxisInput = Input.GetAxisRaw("Vertical");
xAxisInput = -Input.GetAxisRaw("Horizontal");
Vector3 forward = transform.forward;
// rotate forward in the direction of yAxisInput
// rotate forward in the direction of xAxisInput
rigidbody.velocity += forward *(currentFowardSpeed * Time.deltaTime);
...
}
the closest I can figure for the comments standing in for the rotations is Vector3.RotateTowards(), but I am unsure of what arguments to give it. but I feel like those should be already rotated vectors, but that doesn't make sense to me directly as why don't I just use direct vector math to give my new forward vector, and then also use that as the force which goes back to not using the RigidBody to its full potential.
any help cleaning this up would be greatly appreciated.
can you please explain what your answer means. because in all reality without context this looks like spam.
How is it spam? The first link is a C# tutorial on exactly what you are trying to do. These are the best 3 flight tutorials I have come across....
As you are dissatisfied, I shall convert to a comment.
Wow, he was just trying to help, and those links are helpful. Jesus...
Comments that have since been deleted, but as reference to these other comments for future readers :
gardian06 :
my dissatisfaction is that you just through in a link to something without any explanation as to what it is, why I should look at it, or if I should look at the whole thing, or just a segment of it. for all I know I could have asked a question that could be answered in a code sample, and you might have given me a book when all I need is a paragraph from it. and this is presu$$anonymous$$g that the links given is even relevant, and not just I am just going to put a link here that has nothing to do with the question.
just throwing up a link is the same as saying "I don't feel the need to actually explain this, so just go read these volumes of information yourself." which as a $$anonymous$$ching moment is the worst thing to do.
this is all ignoring the fact that just a link is not an answer. an exert from a link (showing link as reference) is an answer. similar to a link to docs because if you look at any thread answered with just a link to the docs the very next reply about 80-90% of the time is "how do I use that in this context", or "I don't see how that helps", or nothing at all.
just at least tell me why I should care about a link that is given, or what part of the stuff on the other side I should even be looking at.
robertbu :
gardian06 - 1) He did not give it to you as an answer. He gave the information to you as a comment. You should not expect an "answer" from a comment. 2) Your question had not been answered after a full day, and far fewer questions that old ever get answered, but he took the time to find and post links to be helpful to you when no one else answered your question.
To be fair I did post as an answer (As you are dissatisfied, I shall convert to a comment.) , however this reply marks the end of my activity on UA, I'm fed up of the attitudes here and feeling like the bad guy. Thank you for your comments @Vonni and @robertbu , good luck for the future.
Your answer
Follow this Question
Related Questions
Rubbery hinge joints 1 Answer
Character Controller children of a car: Inertia effect, delay effect, what??? 1 Answer
Dynamic flight physics help. 0 Answers
RigidBody controller - Where to start? 0 Answers