Hello, I`m writting because I have problem with increasing speed of circle
Here is code how i try to do this:
I don`t understand why "angle" is increasing really fast but "speed" has limit 2.0. How can I change that?
And is there any other way to increase moving speed of the ball/circle?
Here is code how i try to do this:
Code:
void init()
{
b2CircleShape shape;
shape.m_radius = size;
ballBodyDef.type = b2BodyType::b2_dynamicBody;
ballBodyDef.position.Set(x,y);
Colision->m_world->DestroyBody(ballBody);
ballBody = Colision->m_world->CreateBody(&ballBodyDef);
ballBody->CreateFixture(&shape, 10.0f);
static b2MassData mass;
ballBody->GetMassData(&mass);
mass.mass=10000;
ballBody->SetMassData(&mass);
}
void move()
{
m_world->Step(1.0f/fps, 6, 10);
v[0]=-x;v[1]=-y;
x=ballBody->GetPosition().x;
y=ballBody->GetPosition().y;
v[0]+=x;v[1]+=y;//im calculating move vector
speed=vectorodleglosc(v[0],v[1]);// it has LIMIT of 2.0f and i don`t know why???
angle=ballBody->GetAngle();// it`s increasing really FAST
}
void speedUp()
{
ballBody->ApplyForce(b2Vec2(v[0]* ballBody->GetMass()*200,v[1]* ballBody->GetMass()*200),ballBody->GetPosition());
}
{
b2CircleShape shape;
shape.m_radius = size;
ballBodyDef.type = b2BodyType::b2_dynamicBody;
ballBodyDef.position.Set(x,y);
Colision->m_world->DestroyBody(ballBody);
ballBody = Colision->m_world->CreateBody(&ballBodyDef);
ballBody->CreateFixture(&shape, 10.0f);
static b2MassData mass;
ballBody->GetMassData(&mass);
mass.mass=10000;
ballBody->SetMassData(&mass);
}
void move()
{
m_world->Step(1.0f/fps, 6, 10);
v[0]=-x;v[1]=-y;
x=ballBody->GetPosition().x;
y=ballBody->GetPosition().y;
v[0]+=x;v[1]+=y;//im calculating move vector
speed=vectorodleglosc(v[0],v[1]);// it has LIMIT of 2.0f and i don`t know why???
angle=ballBody->GetAngle();// it`s increasing really FAST
}
void speedUp()
{
ballBody->ApplyForce(b2Vec2(v[0]* ballBody->GetMass()*200,v[1]* ballBody->GetMass()*200),ballBody->GetPosition());
}
I don`t understand why "angle" is increasing really fast but "speed" has limit 2.0. How can I change that?
And is there any other way to increase moving speed of the ball/circle?