"Beam" weapon question

Started by
9 comments, last by helix 21 years, 6 months ago
Just as a suggestion, you may want to rethink how you are representing the objects in your universe. It seems to me as if you do not have a player OBJECT but rather the view matrix is directly determining the player''s perspective. Perhaps you could start off by considering the ''player'' just one of the objects in the game universe, and add a function that allows you to ''attach'' the camera view to the player as if it too were an object. This would allow you to shoot your laser from whatever place relative to your player object you wish, and it''s collision would be accurate.

I assume you are generating a model matrix for your objects by concatonating rotation and translation matrices. You can obtain an object''s ''view'' of the world by getting the inverse of it''s model matrix and setting this as the View Matrix. If you have the camera is an object attached to the player, and the weapon as an object attached to another point on the player, then your problem should begin to lessen. The beam should also be it''s own object just using the weapon''s position in world space as a starting point.

In a word, Object Heirarchy.

This topic is closed to new replies.

Advertisement