Advertisement

How to implement bullets movement in 3D world

Started by February 17, 2002 10:56 AM
1 comment, last by yanuart 23 years ago
I have a game where I move my mouse cursor as a crosshair to target enemies, the problem is how to implement : 1. my bullets direction in 3D world 2. the best way to do collison detection of my bullets. Can somebody give me a good idea or article where I can read ??
Ride the thrill of your life
Play Motorama
make a bullet struct/class/whatever, which has 2 3D vectors (one for position, one for velocity). to move it, add the velocity vector to the position one every frame. for collision detection, check if the line between the bullet''s position and it''s next position intersects anything else.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Advertisement
Hi yanuar

For Bullet direction :
i would use 2 point to define the bullet front direction :
1st. the viewpoint position
2nd. unproject the mouse position at a certain z value (weapon range ?)

Then using the two points, you can define a direction vector for the bullet.
As for collision detection, i think krez''s suggestion is fine.

This topic is closed to new replies.

Advertisement