Vector calculation

Hi,

I’m doing some test with physics on unity and i would like to create a vector that is perpendicular to the velocity vector of my rigidbody and with a norm that i have determined before but I can’t find the right solution :x

I’m not sure i’m very clear so i’ll explain with an example:

imagine my velocity vector is (3,10,2) i want to create an another vector how is perpendicular to this vector with a norm of 20 how can i calculate this ?

Thanks a lot for your help guys !!

I’m going to work my math courses now =P

Cross product.

it will return the vector that is perpendicular to the vector you do the cross product.

thanks for your reply,

but I still don’t understand something

You say that cross product can resolve my problem but in order to use it i need two vector and i just have 1 vector and the magnitude of the vector that i need so how to do ?

In fact I just want to apply a force that is perpendicular of the speed vector on my rigidbody with a force of (for exemple) 20 newton (its a calculated value and it’ll vary).

thanks !

EDIT: the force that i need will be located on the xy plan.

You use Vector3.forward/up/down/left/right/sidetoside/etc, etc.

I imagine this is some kind of lift force then?

Should be something like this:

Vector3 force = Vector3.Cross(velocity.normalized, Vector3.up) * 20f;

It’s normalized and multiplied by 20, as you said you wanted it to be at a constant magnitude.

Cheers

1 Like

Yeah that’s for a lift force.

I’ll try what you said Thanks a lot !