[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Line Segments + Rotating a Circle at Constant Speed

Line Segments + Rotating a Circle at Constant Speed

Official forum for the .

Line Segments + Rotating a Circle at Constant Speed

Postby zacaj » Tue May 05, 2009 3:56 pm

Ive got a few(hopefully simple questions).
1. How do I find the moment of inertia of a line segment?
2. Why dont line segments collide with each other?
3. How would I get a circle to roll at a constant speed(No accelleration)?

also:
with cpSpaceResizeActiveHash and cpSpaceResizeStaticHash
according to the moon demo, the first argument should be the average size of your objects, is this diameter, or radius? According to the moon demo, the second number is related to the number of objects you are putting, is this max or average number. In the docs, it says this should be around 10x the size, which isnt related to the number at all, so which one is right?

Thanks
zacaj
 
Posts: 11
Joined: Sat Apr 11, 2009 3:55 pm

Re: Line Segments + Rotating a Circle at Constant Speed

Postby maximile » Tue May 05, 2009 5:09 pm

1. I'd be interested to know this too.
2. It's a legacy from when Chipmunk didn't support line segments with thickness. I usually just add two circles and a rectangle to simulate it (and approximate the moment of inertia using a poly shape).
3. It will roll at a constant speed along a flat surface. Down a hill, you could just set the velocity every frame.
also: Diameter. According to the docs, the second argument should be about 10x the *number* of objects, not the size.
maximile
 
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK

Re: Line Segments + Rotating a Circle at Constant Speed

Postby zacaj » Tue May 05, 2009 7:40 pm

3. How would you get it to roll? I tried setting the torque, but then it accelerated..
zacaj
 
Posts: 11
Joined: Sat Apr 11, 2009 3:55 pm

Re: Line Segments + Rotating a Circle at Constant Speed

Postby Android_X » Wed May 06, 2009 12:16 am

3. If you want it to rotate at a constant speed you could try: setting the angular velocity directly (body->w) and set the inertia to INFINITY so that collisions don't effect the rotation, eg cpBodySetMoment(body, INFINITY);
Android_X
 
Posts: 18
Joined: Wed Oct 31, 2007 7:55 pm

Re: Line Segments + Rotating a Circle at Constant Speed

Postby slembcke » Wed May 06, 2009 1:44 am

Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Line Segments + Rotating a Circle at Constant Speed

Postby zacaj » Wed May 06, 2009 3:43 pm

The rolling works great, thanks. But the line segment acts really wierd...
zacaj
 
Posts: 11
Joined: Sat Apr 11, 2009 3:55 pm

Re: Line Segments + Rotating a Circle at Constant Speed

Postby slembcke » Wed May 06, 2009 4:24 pm

Are you trying the same rolling behavior with a line segment? That might not work so well. It effectively has an infinite amount of torque driving it which might make it look stiff and unrealistic. It could also cause problems if something gets in the way of its turning as it would apply a nearly infinite amount of torque to push it out of the way.

It works well with circles because they only transfer that torque out by friction. The friction force is limited to the force pushing the two surfaces together multiplied by the frictional coefficient of the two surfaces so it can't be infinite.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Line Segments + Rotating a Circle at Constant Speed

Postby zacaj » Wed May 06, 2009 7:17 pm

No, the line segments just a regular body, falling under gravity
zacaj
 
Posts: 11
Joined: Sat Apr 11, 2009 3:55 pm

Re: Line Segments + Rotating a Circle at Constant Speed

Postby slembcke » Wed May 06, 2009 11:43 pm

There is no collision detection function for checking line segments against other line segments if that is what you are asking.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Line Segments + Rotating a Circle at Constant Speed

Postby zacaj » Thu May 07, 2009 8:24 am

No, its falling on a box
zacaj
 
Posts: 11
Joined: Sat Apr 11, 2009 3:55 pm

Next

Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 1 guest

cron