- Home /
How to compute the change in vector when it's referential vector changes?
Hello,
Let's say that I have Vector A and then two other (sub-ordinate) Vectors B & C. When Vector A changes, I wish B and C also to change in accordance. When I say in-accordance I mean like parent-child transformation.
PICTORIAL REPRESENTATION :
CODE :
I supply force to the rigidbodies. These forces are computed when the gravity is (0,-10,0). Now when I want to change the gravity to (10,0,0) what should be the force.
// The required Force applied in Flap mode
void FlapForce()
{
//HORIZONTAL FORCE
if(!HNEXT)
{
rigidbody.AddRelativeForce((Vector3.right) * DeltaTime * LeftDrag * 3);
if(LeftDrag < 400)
LeftDrag += ToTarget(DefaultDrag,TurnSine);
rigidbody.AddForce(2,(-LeftDrag/50),0);
}
if(HNEXT)
{
rigidbody.AddRelativeForce((-Vector3.right) * DeltaTime * RightDrag * 3);
if(RightDrag < 400)
RightDrag += ToTarget(DefaultDrag, TurnSine);
rigidbody.AddForce(-2,(-RightDrag/50),0);
}
//VERTICAL FORCE
if(!VNEXT)
{
rigidbody.AddRelativeForce((Vector3.forward) * DeltaTime * UpDrag * 3);
if(UpDrag < 400)
UpDrag += ToTarget(DefaultDrag,TurnSine);
rigidbody.AddForce(0, (-UpDrag/50),-2);
}
if(VNEXT)
{
rigidbody.AddRelativeForce((-Vector3.forward) * DeltaTime * DownDrag * 3);
if(DownDrag < 400)
DownDrag += ToTarget(DefaultDrag, TurnSine);
rigidbody.AddForce(0,(-DownDrag/50),2);
}
}
Please and Thank you,
How should I compute the forces in accordance to the changes in the gravity?
Karsnen.
Comment