Blackhawk helicopter as main player?
by Robert Brighton · in Torque Game Engine · 05/16/2004 (1:57 pm) · 8 replies
Can anyone help me i am trying to use a model of a blackhawk helicopter as my main player character the blackhawk needs to be in third person not first person and i need help in animating the rotaty blades
as i am only a beginner and not the brightessed scripting genius can anybody point me in the direction of a basic tutorial or give me some help
many thanks
as i am only a beginner and not the brightessed scripting genius can anybody point me in the direction of a basic tutorial or give me some help
many thanks
About the author
#2
it will be cheaper.
I would model the blades and setup an animation for them.
either by having one animation and play that at a rate.
or multi animation's and play them appropriately.
05/17/2004 (1:25 pm)
No I would use animation for this it will be cheaper.
I would model the blades and setup an animation for them.
either by having one animation and play that at a rate.
or multi animation's and play them appropriately.
#3
as for animating the rotary blades i was able to solve this problem i just really need help with the control system now
many many thanks
05/17/2004 (2:42 pm)
Sorry maybe i wasent clear enough ive already got my blackhawk modeled what i want to know is how set up the control system for the blackhawk eg setting it to 3rd person and setting the model controllable by the end user i know i will never be able to make a full game with torque but i am finding the learning experience fun i am not very good a scripting and i am not asking for someone to give me the answer i would be greatfull if someone could point me in the direction of a tutorial so i could learn my selfas for animating the rotary blades i was able to solve this problem i just really need help with the control system now
many many thanks
#4
The plane is controlled with the WASD keys so the throttle is all or nothing. So i only needed 2 animations.
Idle (left image) = the blades are individually modeled and spin slowly
Full Throttle (right image) = blades are replaced by a flat spinning disk that has a blurry texture on it.
It only took a little bit of c++ code to get it to switch animations when you hit the gas.
05/17/2004 (2:46 pm)
I was working on a little war game thing a while ago and i had to animate the prop on my p51 mustang here:
The plane is controlled with the WASD keys so the throttle is all or nothing. So i only needed 2 animations. Idle (left image) = the blades are individually modeled and spin slowly
Full Throttle (right image) = blades are replaced by a flat spinning disk that has a blurry texture on it.
It only took a little bit of c++ code to get it to switch animations when you hit the gas.
#5
once again thats outstanding
many many thanks
05/17/2004 (2:51 pm)
Hey that looks fantastic thats exactly what i am trying to do with the blackhawk ive managed to set the rotary blades spinning its getting the dam thing to fly and be controlled by wasd keys thats my problem as i have extremely limited knowledge of c++ and iam still learning can you point me in the direction of a tutorial or something to get us started am not after an easy answer just a starting point so i can learn myselfonce again thats outstanding
many many thanks
#6
With a name like Eric Hartman, I would think that you would be flying a Me 109. ;)
05/17/2004 (3:06 pm)
Very nice Eric. I'm looking to add aircraft to my game, but until there's a working Terrain manager, what's the point?With a name like Eric Hartman, I would think that you would be flying a Me 109. ;)
#7
I dont really know that much about physics. To get the planes to take off and land, what I did was i started with the wheeledvehicle class and made it act more and more like the flyingvehicle class the faster you went. It worked out pretty well.
Helicopters are complicated but basically, whenever you hit w you want a force to be applied upward on the vehicle. The pitch control would be similar to the flying vehicle class. Take a look at wheeledvehicle::updateforces and flyingvehicle::update forces, thats where most of the action happens.
There was a guy working on helicopters in torque and I thought he posted a resource but i cant seem to find it. He definitely posted a dev pic.
If you cant get anywhere I can post more later but i dont have time right now.
05/17/2004 (4:55 pm)
To get the throttle animation to play, I just copied the code that controls the brakelight thread. I dont really know that much about physics. To get the planes to take off and land, what I did was i started with the wheeledvehicle class and made it act more and more like the flyingvehicle class the faster you went. It worked out pretty well.
Helicopters are complicated but basically, whenever you hit w you want a force to be applied upward on the vehicle. The pitch control would be similar to the flying vehicle class. Take a look at wheeledvehicle::updateforces and flyingvehicle::update forces, thats where most of the action happens.
There was a guy working on helicopters in torque and I thought he posted a resource but i cant seem to find it. He definitely posted a dev pic.
If you cant get anywhere I can post more later but i dont have time right now.
#8
As for spinning rotors, I'd suggest looking into the method that Eric used. It's what I used for mine.. Simple two, three, five, or seven rotors (modeled) that are replaced with an alpha map when at hovering throttle speeds...
Here.. check it: Rotor Demonstration
Might I also suggest looking at flight dynamics of a helicopter and see if you can't modify the flying vehicle to be a chopper. Some people use the hover vehicle as the basis for a chopper, this can be a difficult task. I simply broke down a chopper into it's basic parts. The mainrotor is tilted by the swashplate which is controlled by the washout. Additionally, the blades can be pitched to cause positive or negative lift. This breaks down into two (possibly three) vectors. One is the lift vector (controlled by the collective & throttle) the other (maybe two) are controlling the directional vectors.
Imagine that L1 and L2 are the main chord (span) of the rotor blades. L0 is then the lift vector. If you induce a value into X and Y you begin to pitch in the direction of L3.
Simulating the actual tilt of the main rotor which then induces forces on the fuselage can be difficult. So, in essence the trick is to have a lift vector that changes with the rotation of the entire vehicle. It's a good emulation of the physics of a chopper. Thus, when you tilt the craft in a direction, the lift vector goes from being straight up (0,0,+collective) to being some mix of those (pitch, roll, collective). Yaw is controlled by the tailrotor, which can be a simple value plugged into the yaw value.
Coming up with a control mechanism which simplifies this becomes tricky. You might want to think about linking the throttle and collective so they aren't controlled independently. Thus, an increase in throttle (above hovering idle) would also increase lift. So, that should get you started... hope it helped.
- Brett
05/17/2004 (5:44 pm)
I did some work with making a chopper the main player in my game. Simply replace the datablock that creates a Player object with a Vehicle object in server/scripts/game.cs.As for spinning rotors, I'd suggest looking into the method that Eric used. It's what I used for mine.. Simple two, three, five, or seven rotors (modeled) that are replaced with an alpha map when at hovering throttle speeds...
Here.. check it: Rotor Demonstration
Might I also suggest looking at flight dynamics of a helicopter and see if you can't modify the flying vehicle to be a chopper. Some people use the hover vehicle as the basis for a chopper, this can be a difficult task. I simply broke down a chopper into it's basic parts. The mainrotor is tilted by the swashplate which is controlled by the washout. Additionally, the blades can be pitched to cause positive or negative lift. This breaks down into two (possibly three) vectors. One is the lift vector (controlled by the collective & throttle) the other (maybe two) are controlling the directional vectors.
Imagine that L1 and L2 are the main chord (span) of the rotor blades. L0 is then the lift vector. If you induce a value into X and Y you begin to pitch in the direction of L3.Simulating the actual tilt of the main rotor which then induces forces on the fuselage can be difficult. So, in essence the trick is to have a lift vector that changes with the rotation of the entire vehicle. It's a good emulation of the physics of a chopper. Thus, when you tilt the craft in a direction, the lift vector goes from being straight up (0,0,+collective) to being some mix of those (pitch, roll, collective). Yaw is controlled by the tailrotor, which can be a simple value plugged into the yaw value.
Coming up with a control mechanism which simplifies this becomes tricky. You might want to think about linking the throttle and collective so they aren't controlled independently. Thus, an increase in throttle (above hovering idle) would also increase lift. So, that should get you started... hope it helped.
- Brett
Torque Owner Bryce "Cogburn" Weiner
I'll try to point you in some sort of direction. :)
I wouldn't try to model the actual rotar blades. I would make the rotar blades a disc shaped mesh that has an animated texture that looks like rotating blades.
Off the top of my head, using this method you could handle a speed-up and speed-down of the blades one of two ways. The first method is to create a series of animations like "no_power", "half_power", "full_power" and each of the animations has a slighly faster animated texture. The second option is to research real-time texture swapping (its in the resources) and for each of the power levels swap in an animated texture of varying speeds.
You will learn that for most things Torque-related there is a miriad of ways to solve any single problem. The trick is being able to find the fastest solution that has the lowest overall impact on game performance..... but that's what the forums are for.
Hope this helps.