Sign in to follow this  
pearsoe

How do you make lasers come from turrets in 3D

Recommended Posts

This problem eludes me. In a 3D space game how do you make shots appear to come from specific points from a model (say a gun port on a space fighter or a turret on a capital ship)? This is done in like every 3D space sim and combat flight sim. From a 3D modeling and programming perspective how is this done? After rotating, scaling and transforming an object to world coordinates if you have a hierarchical 3D model structure is there a way to extract the gun port or turrets coordinates as point to start the shot from? I'm using DirectX but any general ideas would be welcome. Also if there are any books that clearly illustrate this that would be great. Thanks.

Share this post


Link to post
Share on other sites
If you have the position the shot should start from in untransformed coordinates (i.e. object coordinates) you could just apply the same transformation to this as to the gun (or turret, or whatever.)

Share this post


Link to post
Share on other sites
I've used bones to indicate locations of weapon emitters, you could also store an offset position based on the origin of the ship, and transform that offset by the same way the ship is transformed, but it might become a bit more difficult if the turret is independantly movable. I'd prefer bones, since typically bones are used to attach objects anyways, the code to get their position is usually there already.

Share this post


Link to post
Share on other sites
Most models (model parts) should have a "pivot point" or a reference point, 1 point that the rest of the vertices in the model is defined from.

for example, you have a tank .. it has a chassi and a turret, how are they connected? in 3ds or others, you can link objects, and then it is the pivot point that is linked to the other object. once you animate turret, you would turn turret around it's pivot point.

you can then link either visible or invisible objects that would be the source, and direction for the laser...

could recommend do some modding for a game (creating models, maybe script a bit too), this would give you lots of insight

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this