Torque around an axle
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Torque around an axle
Is there any way to apply torque around a point? Does that make sense in real-life physics? For example, in the moon buggy tutorial, when torque is applied to the wheel and the opposite is applied to the body isn't it wrong for the body? Shouldn't it be applied around the axle? And can this be accomplished in Chipmunk?
I'm trying to make an easy way for pivot joints to become motors.
I'm trying to make an easy way for pivot joints to become motors.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Torque around an axle
Hmm. Never thought about that before actually. Now that I am thinking about it, it might be more correct to adjust the torque according to the moment of inertia around the point the torque is applied to.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: Torque around an axle
Thanks for the reply. It's good to know I wasn't missing something obvious.
Just to clarify, this isn't something I can currently do in Chipmunk? Can anyone think of a way to fake it? I was thinking of trying to apply forces perpendicular to the vector between the pivot and the object, and relative to the mass of the other object. But I don't think that's right, because it could result in an acceleration of the whole construct.
Just to clarify, this isn't something I can currently do in Chipmunk? Can anyone think of a way to fake it? I was thinking of trying to apply forces perpendicular to the vector between the pivot and the object, and relative to the mass of the other object. But I don't think that's right, because it could result in an acceleration of the whole construct.
-
- Posts: 56
- Joined: Tue Sep 11, 2007 2:30 pm
- Contact:
Re: Torque around an axle
Do you think it would work to apply a regular force on both sides of the pivot? One force upwards and the other downwards, for example. I've unleashed my inkscape skillz and created a potentially illustrative attachment.
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: Torque around an axle
I was thinking about that, but that seemed wrong because at times both forces would be pointing in the same direction, which would accelerate the whole construct.
-
- Posts: 56
- Joined: Tue Sep 11, 2007 2:30 pm
- Contact:
Re: Torque around an axle
I actually intended both the forces in the drawing to be applied to just one of the bodies. (And an inverse pair of forces to be applied to the other body.) I haven't tested this out, but if I have time, I will. I'm thinking something like this:
And
It's not pretty, but maybe it would work?
Code: Select all
static inline void
cpBodyApplyInstantTorque(cpBody *body, float torque, cpVect r)
{
cpBodyApplyImpulse(cpBody *body, cpv(torque, 0.0), cpv(r.x - 1.0f, r.y));
cpBodyApplyImpulse(cpBody *body, cpv(-torque, 0.0), cpv(r.x + 1.0f, r.y));
}
Code: Select all
cpBodyApplyInstantTorque(wheel, 10.0, wheelPosition);
cpBodyApplyInstantTorque(car, -10.0, wheelPosition);
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Torque around an axle
Oh, forgot to post last night. Applying forces like was suggested would work just fine. Though the math behind it is very simple and easy to show that it's exactly the same as adding directly to the torque.
So to answer the original post, there is no such thing as applying torque around an axis. Torque is just torque. (apparently)
So to answer the original post, there is no such thing as applying torque around an axis. Torque is just torque. (apparently)
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: Torque around an axle
supertommy: Ah, thanks for clarifying that. Yeah, looks like it would work.
slembcke: Ok, thanks. Thinking about it, I can see how this would be true, even though my brain wants to tell me it's not.
slembcke: Ok, thanks. Thinking about it, I can see how this would be true, even though my brain wants to tell me it's not.
-
- Posts: 56
- Joined: Tue Sep 11, 2007 2:30 pm
- Contact:
Re: Torque around an axle
So, in order to make a "cpMotorJoint" could you just extend the pivot joint and give it this simple function?slembcke wrote:So to answer the original post, there is no such thing as applying torque around an axis. Torque is just torque. (apparently)
Code: Select all
void
cpMotorJointSetTorque(cpMotorJoint *joint, float torque)
{
joint->joint->a->t -= joint->torque;
joint->joint->b->t += joint->torque;
joint->torque = torque;
joint->joint->a->t += joint->torque;
joint->joint->b->t -= joint->torque;
}
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: Torque around an axle
just tried, seems to work great! I'll post videos when I get my computer back on the net.
Who is online
Users browsing this forum: Heise IT-Markt [Crawler] and 8 guests