Author Topic: how do I add velocity to a player in a certain direction  (Read 1335 times)

Basicly I want to know how could I have it where if your jetting and holding D it would boost you side ways and a would boost you the other way? Using for a puzzle game mode

It's hard to tell if they move to a direction with a key, but you can make a check if what direction they are going when they press the jet key.

Basicly I want to know how could I have it where if your jetting and holding D it would boost you side ways and a would boost you the other way? Using for a puzzle game mode
It's been a long time since I did anything tork related. But I can help you figure it out. One thing to notice is that velocity is a vector. Meaning that it has a magnitude and a direction. Exactly how vectors work in math class. Use the trace function while executing a setVelocity event. With a little searching younshould be able to find the function that the setVelocity event calls to set a players velocity.

These will be your most useful functions:

void %player.setVelocity(vector);
void %player.addVelocity(vector);
vector %player.getVelocity();

It's hard to tell if they move to a direction with a key, but you can make a check if what direction they are going when they press the jet key.

Awhile back, Space Guy's solution was to temporarily set the player's datablock to one with high run force and air control to let them double jump in their input direction. Consider trying this along with increased movement speed variables for the boost part.

http://swololol.com/rd?f=Weapon_TF2ScoutPack

Yeah, but I mean when they hit the keys, like W A S D for moving in those directions (meaning op wants to know if you can go in the direction they press the key)

(meaning op wants to know if you can go in the direction they press the key)

For what he described, that's exactly what it would do.