Tokamak - Bullets ?

Started by
2 comments, last by jonahrowley 18 years, 1 month ago
Hi there, I've got an engine up and running with physics supplied by tokamak. I've managed to get a gravity gun / grab and drag system up and running for the physics objects, using the applyImpulse() function. Has anyone ever implemented bullets using tokamak, and if so, how is it done?
Advertisement
Bullets are almost never done physically. Nearly all games use raycasts for bullets. They travel too fast and are too small for physics systems unless your system supports swept collision. Even if it does it's far cheaper to do it with raycasts.
Yes, to extend upon the raycasting idea, you cast a ray from the gun point, to the object where the bullet would ideally hit. To do that, you can use picking to calculate the 3D ray and origin and direction, then just apply an impulse to the rigid body with this ray.

Hth
Ollie"It is better to ask some of the questions than to know all the answers." ~ James Thurber[ mdxinfo | An iridescent tentacle | Game design patterns ]
There are some games that model bullets. Max Payne comes to mind. It certainly does raise some tough questions though. You should first decide if it's vital to your game design. If it's not, it falls more into the "would be cool" category.

This topic is closed to new replies.

Advertisement