AddForce By Direction Of rigidbody.velocity?

How can i addd Force By rigidbody.velocity so i have checked the direction First and then dont know what to do to inverse the Direction so what i have done like that

my : transform;
function Update(){
My.transform = rigidbody.velocity.x
if(){
AddForce(0,-My.transform,0);
}
}

but Hopelessly Didnt Work

I think you need to understand basic programming a bit more, but that will come I guess. You need to watch your capitalization as well as your types. In your code you’re trying to assign a float (a number like 1.2) to a transform (a scene object). Then in your force code you’re trying to specify the opposite of your transform (non existent result) as a force direction, with no force. Give this a shot.

var t : GameObject;
var multiplier : float;

function Update(){
AddForce(t.rigidbody.velocity * multiplier, ForceMode.SetVelocity);
}

Using the ForceMode setting you are telling it to instantly change the velocity, there are a number of other ForceMode options which let you apply the force differently, check them in your IDE and experiment.

In your example you’re trying to apply it to just the X axis. Because this is a rigidbody it’s probably a good idea to just lock the axis in the rigidbody itself. That way nothing that interacts with the moving object is going to throw it off axis.