When creating your own model for a weapon, say the M4 carbine, and using the model in your game. Do you need a license to use it commercially? I know that racing games like GT5 has a license for each and every car, but the same apply for weapons?
I am not a lawyer and you should consult one for real, accurate legal advice.
The name and design are likely trademarked (you can see here for example that there have been trademark issues with the M4 in the past; other guns will likely have similar issues).
EDIT: It is possible that as far as a trademark is concerned I may have been misinterpreting things, and it may be okay depending on your circumstances. However, you will still potentially need to worry about other intellectual property restrictions (such as any copyrights held in relation to the item in question) which do apply regardless of whether or not your product is commercially available.
At the end of the day, if you violate somebody's intellectual property laws and they call you on it you can be in a world of hurt so it's best to get real legal advice because the risk is pretty severe. There's a good set of articles on intellectual property issues by a Real Lawyer here.
It seems that in most cases the name of the weapon is partially changed and sometimes the model, though usually the weapon models are very similar to the actual weapon. tvtropes has several good real world examples of guns in games that have had changes to their names: http://tvtropes.org/pmwiki/pmwiki.php/Main/AKA47
I don't think you do need a license for several reasons, but I'm not a lawyer.
Trademarks are not copyrights or patents. Trademarks are designed to protect consumers. The idea being that a trademarked M4 carbine, for example, is made by Colt Defense (or someone they have licensed to build them) and not by some other company making cheaper versions. The OEM can stop the cheaper company from calling its product an M4 but can't stop it from making the copies. Stopping manfuacturing can only be done through patents. Recently, there has been a dispute between Ford and the Ferari F1 racing team over the name F150. Although the two vehicles could never be confused, this was done primarily to keep hold of the trademark, not enforcing the trademark is one way of losing ownership of the trademark.
There are many other things that appear in video games that have trademarks, are they all licensed? Why should the M4 be special?
Do other media pay licenses to use the trademark. For example, if a James Bond novel had a description of someone hold an M4, would that require a license?
You are not selling a gun. Trademarks can only be enforced against similar products. A game is not a gun, in the same way it's not a drink, shop, car, etc.
In the USA, you can claim the First Amendment (free speech) and fair use.
As for games like GT5, they are probably not licensing the trademark, and probably couldn't license it as they aren't building cars. They are probably licensing the copyright on the names and logos.
IANAL but names and logos are trademarked. The appearance of a gun is not, unless there is a specific design patent, which is rare. Mechanical patents don't apply here.
So just don't use any actual names or logos. I am not sure about "M4" specifically. It is really a family of weapons and not specific weapon from a specific manufacturer. Definitely do not call it a Colt M4, for example. I saw another comment where you asked about an FN rifle. FN stands for the name of the company Fabrique Nationale, so you also can't use that.
I think you should just make up your own names for the guns, but consult an actual lawyer anyway.
In Reality and Legal terms, most guns are trademarked twice AND patented both in terms of manufacturing and looks. The trademark includes the gun's own logo and the gun's visual identification.
This means that any manufacturer and patent holder of any of those guns "could" do legal action against you if you were to use the exact replica of their guns. This includes visual, sounds and logotypes (logos).
Now, there are ways of moving around those legal possibilities:
1) Modifying the name and gun, visually, so that it's different. Ideally, you have to make it 20% different (80% alike) and you're safe. In terms of games, that's easier to do because you don't have to "create" the inner mecanism of the guns so having something like a different gun sound + changing some small details usually works.
2) Using old schematics that hasn't been renewed in the past 15 years. This is one of those legal grey zones where any manufacturer has the legal obligation to renew any of their product's visual trademarks every year. (It cost around 100 USD per trademark). After 15 years without any renew, the trademark becomes idle and anybody can "use" the visual as they like. There would be some difficulties if you were a gun manufacturer trying to use such as thing, but for games it's kinda like a legal grey zone where the manufacturer can't do anything as long as it doesn't renew its trademark license and, then, it can only stop any "further" additions.
The thing about guns is that they are usually modified every 4 to 5 years. If you find some pictures or schematics of any model that is 15 years old AND has been updated at least once since then (meaning the gun is now slightly different than its past form), you can usually use the older form due to the manufacturer who, usually, doesn't renew its older "look" as a trademark. The name is usually the same so you might have to change the name though.
There "are" some exception to that when, for example, a country take over a gun schematics for further modification and put up an open request for new versions such as the M4. This bring the complication of having multiple version of the M4's trademark "still" valid (one is owned by Colt, one is owned by the US Army itself and one is owned by Remington Arms Co. in the case of the M4).
The most ideal for you is to think of your own version of the gun by adding and removing details. It's not "that" hard as the manufacturer usually add many useless details or reinforcement part to their gun for the sake of making them look more "dangerous" (less toy-like). Change the cannon lenght, the hand grip, trigger and modify some of the details on the main body and you're mostly up to go. Instead of calling it a M4 (for example), call it ARM4 or even something like M-A4 could work if it doesn't exist already.