Game Development Community

More Realistic Heli

by Stephen · in Torque Game Engine · 06/10/2006 (10:06 am) · 9 replies

I'm using the Helicopter Resource and found it to be a bit to much like a hovercraft (movement wise). So I have been trying to fix the helicopter to seem more realistic but I haven't had any luck. I have two questions that I think would make the helicopter seem more realistic.

Question One:
With the mouse for the helicopter, I would like to change the controls on the left and right to tilt side to side. Like you move the mouse forward and backward, the helicopter tilts forward and backwards. If you move the mouse left to right, the helicopter tilts side to side instead of turning left and right?

Question Two:
With the first question changing the control to tilt the helicopter, I need help with making the helicopter to move faster when tilting. What I mean is when you move your mouse forward it tilts the helicopter's nose down and you move forward, the farther you move your down the faster you go. A good example of what I'm talking about is when you fly a helicopter in Battlefield 2.

Thanks,
Tek0

EDIT: I forgot to add that I noticed when you change seats in the helicopter, it just hovers and slowly goes down to the ground. How can I make it where if there is no driver, it loses control until another driver takes control of the helicopter.

#1
06/10/2006 (8:40 pm)
Anyone have any ideas?
#2
06/10/2006 (10:21 pm)
The only person I know who has decent helicopter code is Brett Fattori

I predict he would receive 500 emails a day from people wanting his code, even offering to pay for it, and he hasn't cracked yet.
#3
06/10/2006 (10:34 pm)
Well it doesnt have to be very realistic. Just the main things that I would like to fix would be the mouse control and when you tilt you mouse the helicopter goes faster (well speeds up, not sure how to explain it). Nothing to hard.
#4
06/10/2006 (10:44 pm)
Take a look at void HeliVehicle::updateForces(F32 /*dt*/)

This is where the meat of the physics is located.
#5
06/10/2006 (10:50 pm)
See I don't have that much C++ knowledge, could you help me out a bit?
#6
06/10/2006 (11:00 pm)
C++ isn't the problem for me, it's the fact that I have had absolutely no educational experience with trigonometry or any math beyond basic algebra. With a fundamental grasp of trig it seems that this kind of thing would be easy. Anybody know of a good book for learning about trig and/or calculus that would be most appropriate for this kind of thing?
#7
06/11/2006 (10:13 am)
Well I messed this part in the helivehice.cc and changed a few things in the script.

static F32 sheliVehicleGravity = -20;

And I also got the movement that I want but the thing I need help with is the mouse control. How to make it tilt side to side instead of turning left and right.

Oh I also noticed that I can not land on the ground without the helicopter goes crazy. I did change the hoverHeight and createHoverHeight in helivehicle and in the script to "0". When I try landing it starts the lean back and then half-way fall though the terrain. Could this be because of the collision box, mass node? I'm not sure why the helicopter goes crazy when I try landing.
#8
06/12/2006 (8:42 pm)
Anyone know how I can set up the mouse control to tilt side to side?
#9
07/22/2006 (2:55 am)
The term in this case is 'roll' and not 'tilt'. I know it's a minor semantical issue, but a search for 'yaw roll pitch' will produce some useful, if not directly applicable results. HoverVehicle has 'rollForce' defined, FlyingVehicle and HeliVehicle both have 'rollForce' and 'steeringRollForce' defined. I think the 'steeringRollForce' is related to how the yaw (steering, turning left/right) of the flyingVehicle is for some reason linked to the roll (tilt left/right).

This is a snippit of the HeliVehicle's updateForces() function:
// Roll //change
   torque += yv * steering.x * mDataBlock->steeringRollForce;
   F32 ar = mDataBlock->autoAngularForce * mDot(xv,Point3F(0,0,1));
   ar -= mDataBlock->rollForce * mDot(xv, mRigid.linVelocity);
   torque += ar * yv;//yv * ar

And this is the same piece of code from the flyingVehicle:
// Roll
   torque += yv * steering.x * mDataBlock->steeringRollForce;
   F32 ar = mDataBlock->autoAngularForce * mDot(xv,Point3F(0,0,1));
   ar -= mDataBlock->rollForce * mDot(xv, mRigid.linVelocity);
   torque += yv * ar;

I don't know what an angularForce is exactly, and I don't know what mDot does, I have a _vague_ understanding of linear velocity. As it is, this code almost makes sense, but not enough that I would know what to change. I think we would just need to send an appropriate rollForce based on the mouse movement, but I don't know how to do that either.