Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (TedMar, VoroneTZ, vicknick), 825 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Plane physics #291386
09/24/09 20:55
09/24/09 20:55
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
I have a plane, it flies if I press "W" (simple c_move movement), rolls and tilts, if I move the mouse. But I have a problem: I wanna "teach" it to accelerate and take off. First question: How to put it on the ground? I wrote a code:
Click to reveal..
...trace_to_ground = c_trace(my.x, vector(my.x,my.y,my.z-1000), IGNORE_ME|IGNORE_PASSENTS|IGNORE_PASSABLE|IGNORE_SPRITES|USE_BOX);
if(trace_to_ground>1){my.z = -275;}...

So now it stand on the ground, but only in a particular spot(since the terrain is not flat) and I cannot stick it to the terrain with a c_trace. I decided to add physics, standard GS functions phent_settype, phent_gravity, phent_mass, etc. Now it stands on the ground but it does not react to pressing any buttons. I read somewhere that c_commands do not work with physics. So I added ...phent_addforcelocal (me, vector(forward,0,0), nullvector); if(forward <5000)//limitation of accelreation// forward +=20;... to the "key_w". Now it can speed up to a huge speed and than suddenly stops and stands still(I think after reaching the 5000 speed) and noting can move it + it is uncontrollable. Second question: how to apply movement physics properly (any tutorial would be helpful) and avoid all this bugs or whatever it is, and make its speed become steady and equal 5000 when it reaches this speed? Since it is a plane, it should take off, fly up, but can't fugure out how to do this. I tried to lower the mass and gravity force as it accelerates so that they both equal 0 when it reaches certain "taking off" speed (approximately 2500) but it changed nothing, actually had no effect at all. I cannot add a vertical acceleration (like for a helycopter) since this does not satisfy plane controls... I have to raise it up at first (tilt it) since it always flies forward. So the third question: How to make my plane take off so that it does not contradict with the mass and gravity force?
I know about Newton physics, but I do not know how difficult it is to accomplish this all with it. Genrally, I just whant to understand the principle of the plane motion (it should behave like a car when it is on the ground and then be able to take off when it has proper speed)...Sorry for the long post....


a generator of dull questions smile
Re: Plane physics [Re: BastovBros] #292487
10/04/09 04:16
10/04/09 04:16
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
You don't want to try and use a physics engine for flight simulations, they never come out right. You'll have much better results programming your own physics. If I had access to my computer I'd share my code (at a friends). Just use some reverse trig (asin; acos) based on the planes angles to calculate your forces (lift; drag; etc).


xXxGuitar511
- Programmer

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