Game Development Community

Barrel roll?

by JP · in Torque Game Engine · 11/17/2008 (4:41 pm) · 3 replies

I have a flying vehicle and when I double tap a key I want the vehicle to perform a complete barrel roll to the side, sort of like what the banshee does in Halo 2. Any ideas how to do this?

If something like this has been asked before, I apologize. I did a search for "barrel roll" but nothing useful came up.

#1
11/18/2008 (8:30 am)
Vehicles in Torque are capable of doing barrel rolls by simply adjusting the SteeringRollForce and RollForce fields in the datablock, and turning, by default Torque tries to prevent you from doing so. But from your description it sounds like you want to hotkey a roll animation - I've never played Halo. Wanting to use a double tap means you will need to alter the way in which Torque captures key events.
#2
11/18/2008 (2:50 pm)
Thanks for the reply.

I know about the rollforce stuff. My vehicle already rolls when I hold down A or D. What I'm looking for is a key bind that will make the vehicle do a complete roll and move it to the side without holding down the key. It's a move that would be used for dodging missiles and such.
#3
11/18/2008 (3:56 pm)
Without putting to much thought into it, what comes to mind first is to have a timer that is triggered with each press of the key

if(LEFT)
  {
  if(leftTimer$ < 1sec.)
    barrelRollLeft();
  else
    moveLeft();

  leftTimer$ = 0;
  }