Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

I am trying to simulate a game in Box2D(Physics engine). The game that I am trying to simulate is very simple and can be found here: http://www.makaimedia.com/#/speartoss

What I want to know is that, is the spear in that game following real physics principles? In other words, if I went out and threw a spear, will it behave like the spear in this game? Specifically, I am taking about the rotation of the spear. In the game, the spearhead is point up first half of the trajectory and as soon as it hits the vertex, the spear head starts point down.

I am simulating a spear in Box2d physics engine. The density of the spear is 15x more than the density of the handle. I set an angle (between 0, 90 degrees) and give it a linear velocity like this:

    b2Vec2 force;
    force.Set(cos(angle) * 22.0f , sin(angle) * 22.0f);
    _spearBody->SetLinearVelocity(force);

What happens is, the spearhead never points downwards. It stays at the exact same angle throughout the trajectory. Is this more realistic or the physics in speartoss game?

Thanks.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

It is following a very incidental "special case" of physics.

The spear can be represented as a rigid body with a center of mass. When you impart purely linear velocity, the spear's center of mass will travel according to projectile motion. There is no reason for the spear to change it's orientation.

For the spear to change it's orientation, a rotational force, or torque, is required. For the simulation you linked to be accomplished in a natural manner, the thrower would have to impart a specific "twist" with his wrist at the time of release, just enough so that the rotational velocity corresponds exactly to the orientation of the spear's linear velocity.

In reality, the simulation probably just changes the orientation at every step to align with the velocity vector. This is quite common.

EDIT:

I should note that this "special case" is actually very natural during a real human throw. The rotational velocity at release comes from the way you rotate your forearm during the throw. Humans have a natural intuition about physics like that, same as playing sports.

share|improve this answer
    
Hey. Thanks for the reply. Applying angular velocity to the body makes it behave the way I wanted. Do you know what I should set the angular velocity to so the spearhead stays pointing upwards for first half of trajectory and then starts point down the second half (just like in the game)? Thanks again. –  RungaHaDeMangoes Jul 5 '11 at 21:42
    
Well I'm not ALL to familiar with Box2D, but there might be some sort of way you can directly set the angle at each step of the simulation, in which case you can just make it the same angle as the velocity vector. If you want to do the proper way, however, you'll also have problems with the spearhead being 15x as dense as the spear body. You'll probably want to make it uniform density, thus putting the center of mass at the center of the rod. As for the mathematics of initial angular velocity <=> initial linear velocity I'll have to work it out and put it in an edit. –  user3390 Jul 6 '11 at 6:05
    
Actually, I'm going to have to post a new question. After looking at the math, I'm not sure that there IS a way for the spear to naturally align perfectly with the velocity vector. I don't think it's achievable in a fair simulation. I'll post my own question about this later; now I'm curious. –  user3390 Jul 6 '11 at 7:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.