이것은 순수한 물리학적인 질문이지만, 왜 작동하지 않는지는 모르겠다. 나는 움직이는 물체가있다. 나는 값을 얻는다. vcos (theta)와 vsin (theta)의 ... 이것으로부터 저는 운동의 속도와 각을 계산합니다 ..... 또한 또 다른 점 (x, y)을 알고이 점으로 객체를 향하고 싶습니다. 내가 포인트를 향해 객체를 지시하는 특정 힘 (힘은 X와 Y 축 값을 가져야 만한다.)을 적용 할 필요가있다. 그래서 나는 단지 필요한 힘의 양을 얻기 위해 공식을 따라야한다.움직이는 물체의 방향을 바꾸십시오 .... (순수한 물리 질문)
fX = V2cos (theta2) -V1cos (theta1) fY = V2sin (theta2) -V1sin (theta1)
그는 syntex가 주어진다 (나는 그 사람들이 객관적인 C를 안다는 것에 대해) ......... 내 방정식이 작동하지 않는다 ..... 아무도 도와 줄 수있다 ......
if (acceleration.x>1.5 || acceleration.y>1.5) {
shakeCounter++;
[_label setString:[NSString stringWithFormat:@"%d",shakeCounter]];
//get the velocity of moving object.......................
b2Vec2 mVelik = ballBody->GetLinearVelocityFromLocalPoint(localPoint);
float angleOfCurrentDirectionOfMotion;
float angleOfDesiredDirectionOfMotion;
//calculate first velocity
float V1=sqrt(pow(mVelik.x, 2)+pow(mVelik.y, 2));
//calculate second velocity
float V2=V1+factor;
//calculate current angle
angleOfCurrentDirectionOfMotion=atan(mVelik.y/mVelik.x);
//calculate desired angle
angleOfDesiredDirectionOfMotion=atan(acceleration.y/acceleration.x);
///calculate FX and FY
float X=V2*cos(angleOfDesiredDirectionOfMotion)-V1*cos(angleOfCurrentDirectionOfMotion);
float Y=V2*sin(angleOfDesiredDirectionOfMotion)-V1*sin(angleOfCurrentDirectionOfMotion);
b2Vec2 force = b2Vec2(X,Y);
///apply Force to change direction....
ballBody->ApplyForce(force, ballBody->GetPosition());
}
(x, y)에 고정 된 스프링이나 (x, y)를 통과하여 이동하는 것처럼 개체를 이동 하시겠습니까? –
'인자'란 무엇이며, 'V2'는 무엇을 나타 냅니까? –
@Cantos : 아니요 .... 속도를 높이기 위해 V2를 높이고 싶습니다. – Rony