Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (juanex, AndrewAMD), 988 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problems making an airplane look to it's speed direction #309197
02/07/10 20:38
02/07/10 20:38
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline OP
Serious User
painkiller  Offline OP
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
Hi, i've an airplane, and I need to simulate the aerodynamic forces (angular forces) wich makes the plane to look always to it's speed direction. F.example: You yaw right the airplane, and afther it must return to it's speed direction, so the airplane must hace an angular force wich makes it to look where it's going. But this force mustn't change the plane's roll.

I've created this code but it doesn't work:

Code:
vec_diff(center, plane.pan, direction); //count the angle difference between plane an it's direction
vec_set(center, vector(sign(center.x)*0.08, sign(center.y)*0.08 , 0)); //scale the torque
phent_addtorqueglobal (plane, center);



I need help to do this right, i've tried lot's of things but i can't get it work properly

Last edited by painkiller; 02/07/10 20:38.

3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Problems making an airplane look to it's speed direction [Re: painkiller] #309860
02/11/10 17:45
02/11/10 17:45
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline OP
Serious User
painkiller  Offline OP
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
please, nobody can help me?


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Problems making an airplane look to it's speed direction [Re: painkiller] #318301
04/06/10 20:44
04/06/10 20:44
Joined: Apr 2010
Posts: 38
D
deianthropus Offline
Newbie
deianthropus  Offline
Newbie
D

Joined: Apr 2010
Posts: 38
i did this in reverse very recently. I had a ball rolling on a surface whose view was set by the camera. The ball always has to roll in the direction of the camera view, so the force applied to the ball is a vector whose x-coordinate is the cosin of the angle complimentary to the angle at which the camera looks at the ball, multiplied by the ground distance (distance of the camera on the x and y plane), and therefore also the y-value of the vector is radius * sin(ang).

The same principles apply to your problem, only in reverse. I can't tell you the specifics of your problem (except that I try to avoid magic numbers like your 0.08 coefficient), but sketch out the problem in terms of a unit circle and assign variables (on paper) to EVERY part of the problem, even the things you'll discard when you actually program it. That's been my technique so far.



Last edited by deianthropus; 04/06/10 20:52.
Re: Problems making an airplane look to it's speed direction [Re: deianthropus] #323952
05/18/10 15:48
05/18/10 15:48
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline
Member
TehV  Offline
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
Hmm, the easiest solution I know would be to add damping to your plane, around 50 units for linear, and 25 units for angluar.
Then I would glue a small piece to the tip of the plane (Not sure how to do this though) that has about the same weight as the plane. This block should not have damping.
This will cause the block to pull the plane's tip into the direcion the plane is flying. However, you will also have to apply all your forces to the block instead of to the actual plane.
You can make the small block passable and invisible to avoid physics interactions with other items.
The block should have about 5% of the planes width, height and lenght.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1