• Create Account

Banner advertising on our site currently available from just \$5!

# [Box2D]Problem with joints - simple moving

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1furrymaster  Members   -  Reputation: 100

Like
0Likes
Like

Posted 21 May 2011 - 02:07 PM

Hi, Im writting because i have problem with using joints in Box2D. Im trying to create simple moving system for my units but i cannot find out how to move units with this and this speed. I was trying to use linear Velocity but i have to control when units are on place in which i want them. Ive tried joints but they are working like a... gum? U know, at start they move slow but if they are closer to target position my unit moves faster.
Can u give me an advice how to use joints to have an effect like i want? (i was looking for good tutorial about this but all are with jumping boxes, moving them with mouse or car with wheels:( )
If I helped you rate me

### #2SriLumpa  Members   -  Reputation: 198

Like
0Likes
Like

Posted 22 May 2011 - 03:28 PM

Try to search for "kinematic" bodies. The documentation advises to move the by setting their velocity, but that's not very hard to adapt to follow a position path.

### #3furrymaster  Members   -  Reputation: 100

Like
0Likes
Like

Posted 23 May 2011 - 12:19 AM

But when i setting their velocity ill have to control when to stop them because this is force vector, so when they reach my target they will still keep moving.
If I helped you rate me

### #4SriLumpa  Members   -  Reputation: 198

Like
1Likes
Like

Posted 24 May 2011 - 03:50 PM

It is not a "force vector", just the velocity. But like a manual force, you have to recalculate the value at each step. So for example when the target is reached, you just set the velocity to 0.

### #5furrymaster  Members   -  Reputation: 100

Like
0Likes
Like

Posted 24 May 2011 - 11:11 PM

thank you i ll try to use it.

Edit:
kinematics are bad idea because i need colisions, sometimes joints etc.
And still i dont know WHEN to stop moving object.
If i do sth like this:
Vector_2D range=pos - target;
range=range*range;
if(range.x+range.y < 10)
stop();

my body can still keep moving if it colide with something in its way.
If I helped you rate me

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS