Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / [Help] Simple Bullet Fire Function

Author
Message
Wana7262
8
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 29th Jun 2012 18:01
Hi all.... i just need a simple bullet fire function for my FPS game... i tried function from Dark Dungeons but its not working.... can any one post a simple bullet function...
Thanks
Mr Bigglesworth
12
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 29th Jun 2012 18:40
Are you using any physics packages (Sparky's, Dark DynamiX)? If so, you could use the raycast function in them, if not, you could create a small cube (or load a model), and when the mouse is clicked you create at the end of the barrel and use dbMoveObject to accelerate it.
Wana7262
8
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 29th Jun 2012 18:43
i m using Sparky's plugin... i have done what u said.... its all working but the bullet is firing from only one location i mean if i move mouse down and click the mouse the bullet fire location remains same
Mr Bigglesworth
12
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 29th Jun 2012 18:57 Edited at: 29th Jun 2012 19:04
You could lock it to the camera to allow it to rotate with it.
Wana7262
8
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 29th Jun 2012 19:00
can i lock multiple objects with camera??? mean to say i have already locked my player's hands with cam....can i lock bullet object too?
Mr Bigglesworth
12
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 29th Jun 2012 19:04
Yes, you can lock multiple objects.

If you use Sparky's, I recommend using raycasting. It would be easier then moving a cube and checking where it collides.

Using this:



It will cast a ray from the camera and store the object that it hit in the "collide" variable.
Wana7262
8
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 29th Jun 2012 19:10
hmmm thank u .... i have a question... do i have to create a sphere around my model of enemy? or it will just simply detect and calculate collision ???? in many tutorials i have seen that they create a sphere or box around the object to check collisions... what is the use of it??
Mr Bigglesworth
12
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 29th Jun 2012 19:23
If you set up your enemy with Sparky's, you won't need a box around the enemy, Sparky's will do that for you.
Wana7262
8
Years of Service
User Offline
Joined: 23rd Nov 2011
Location:
Posted: 4th Jul 2012 15:06 Edited at: 4th Jul 2012 15:14
collide is returning always 0 on mouse click and aim is from camera to object.....

EDIT: Sorry its returning Object ID after SC_UpdateObject(11).... thannks

Login to post a reply

Server time is: 2020-03-31 03:32:24
Your offset time is: 2020-03-31 03:32:24