Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

How to implement bullets movement in 3D world

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 yanuart   Members   

162
Like
Likes
Like

Posted 17 February 2002 - 04:56 AM

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 ??

#2 krez   Members   

443
Like
Likes
Like

Posted 17 February 2002 - 12:24 PM

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.

#3 ZeroBit   Members   

122
Like
Likes
Like

Posted 17 February 2002 - 02:07 PM

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.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.