Hello everyone,
i am always confused where to put my threads here, so i am trying it here this time
Again, i am working on some physic simulation stuff and i somehow cant figure this problem out...
Basically what i am trying to do is to create the controls for a spaceship flown by the player. Since all the flying stuff is controlled by the physic part of the engine i want to do this "physically" correct.
I started by implementing the most basic stuff, moving forwards, backwards and strafing. Those are easy to do, i just have to get the "look" vector (its the direction the object is facing) of the object i want to steer and move it back and forth or i have to get the cross product of the look vector and the up vector to get a vector on which i can move it sideways.
Rotation around the look vector (i think its called rolling ) is easy, too. There are two ways to do this:
- Apply torque to the whole object so it rotates.
- Apply a force somewhere above the object and the same force in the opposite direction below the object to get a rotation (Take a look at the attachment to hopefully understand what i tried to describe!). I prefer this approach because its more like the "i have mini thrusters to do fancy stuff (rotating) in space" thing that modern spacecraft tend to use.
And now here is my problem: The last part i need is a convenient way to control the flight direction. It is more or less easy to apply the same concept for rotation around the look vector to make it possible to change the viewing direction. I take the mouse position and calculate the distance from the center in both 2dimensional axis to get a direction where to move to and apply a force to the look vector of my object to get it to "look" to the right direction.
This works great, i can turn and spin around like crazy but i cant smoothly fly around. If i start into on direction and then turn the ship it continues to move in the old direction.
I know this is like it would happen in space, als long as there is no other force i would continue the movement. But this is not the steering behaviour we want to have. We want something that doesnt break the whole idea of simulated physic by using forces to interact with objects but makes it possible to change the flight direction... There has to be a way... I hope... Well at least i hope someone understands what i just wrote and what my problem ist
i am always confused where to put my threads here, so i am trying it here this time
Again, i am working on some physic simulation stuff and i somehow cant figure this problem out...
Basically what i am trying to do is to create the controls for a spaceship flown by the player. Since all the flying stuff is controlled by the physic part of the engine i want to do this "physically" correct.
I started by implementing the most basic stuff, moving forwards, backwards and strafing. Those are easy to do, i just have to get the "look" vector (its the direction the object is facing) of the object i want to steer and move it back and forth or i have to get the cross product of the look vector and the up vector to get a vector on which i can move it sideways.
Rotation around the look vector (i think its called rolling ) is easy, too. There are two ways to do this:
- Apply torque to the whole object so it rotates.
- Apply a force somewhere above the object and the same force in the opposite direction below the object to get a rotation (Take a look at the attachment to hopefully understand what i tried to describe!). I prefer this approach because its more like the "i have mini thrusters to do fancy stuff (rotating) in space" thing that modern spacecraft tend to use.
And now here is my problem: The last part i need is a convenient way to control the flight direction. It is more or less easy to apply the same concept for rotation around the look vector to make it possible to change the viewing direction. I take the mouse position and calculate the distance from the center in both 2dimensional axis to get a direction where to move to and apply a force to the look vector of my object to get it to "look" to the right direction.
This works great, i can turn and spin around like crazy but i cant smoothly fly around. If i start into on direction and then turn the ship it continues to move in the old direction.
I know this is like it would happen in space, als long as there is no other force i would continue the movement. But this is not the steering behaviour we want to have. We want something that doesnt break the whole idea of simulated physic by using forces to interact with objects but makes it possible to change the flight direction... There has to be a way... I hope... Well at least i hope someone understands what i just wrote and what my problem ist