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.

Newcomers DBPro Corner / [DBP] Bullet Fire

Author
Message
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 18th May 2010 02:29
Hey need some small help. I have got my bullet setup, And it fires no problem. The problem i am having is... A: Bullet is to far away from the gun B: well you can see it in the vid i have posted. (Extra rotating ghost bullet lol)

Thanks in advance to anyone who helps

The code is from the forums





======================================

Attachments

Login to view attachments
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 19th May 2010 20:59
No one able to help please?

======================================
owlman
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 20th May 2010 20:59
hi Unix .. Im not sure but mayb ppl dont get what you are asking exactly .. and are unwilling to download an unknown file onto their system to find out. why can't you positon the object bala on the end of your weapon? .. seems fairly easy.

just another thought .. when you fire that thing, are you going to see it move? I've fired a few real life weapons in my time, but I have never seen a bullet move. mayb there's another way to do it?

if effort>reward : gosub home : endif
zeroSlave
15
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 20th May 2010 22:28 Edited at: 20th May 2010 22:28
Change up your code a bit like so:



You should only have to position the bullet and rotate it at the very beginning of when it is shot. After it is shot, it should not rely on the position or angle of the gun. If it is still getting that information while you are moving, the bullet will change it's trajectory.

Hopefully, this helps.

My green thumb grew the tree my Trojan War horse was crafted from. With roses in our pockets we rally round the tombstones. Ashes to ashes, we all fall down.
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 21st May 2010 04:24
@owlman Yah i should of posted it on youtube, I am norm on at like 4am lol. (are you going to see it move) No, I just had it visible so i know where it was positioned. (why can't you position the object bala on the end of your weapon?) I thought i had it positioned to my gun but it still was to far away.

@CoughMist Thank you for the info, I will try it out once i get home. I am on my pda so not at my pc's.

I appreciate both of your guys help and info thank you very much

P.S there is lots more then what you see in the vid i just have everything disabled well mostly lol

======================================
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 21st May 2010 19:04 Edited at: 21st May 2010 19:05
@CoughMist So i tried your way, The bullet showed up no problems. But it just sits in front of the gun about a few inch's away and blinks. It's all good i will figure it out shortly. I am wondering thoe instead of locking the object onto the gun, Add a limb? if this is the right term. Add one to the gun then attach the bullet to the limb?

Edit: or is it create a mesh from one object say a box and add it to the item?

======================================
zeroSlave
15
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 22nd May 2010 01:07
I'm not sure about the limbs option. The only thing I have really done with limbs is using them for animations based on the already stored limbs in a 3d .x file.

I'm not sure why it just sits there and blinks! o_O You may try increasing the "move object bala, 10" to something like "move object bala, 50" for testing.

I can understand the need for a bullet if it is going to be used for a slow projectile for rockets or such, but If you are going to be using it for collision, be careful.

Let's say that when your bullet flies out of the gun, it is positioned at 0,0,0. Then next screen refresh, it will be at 0,0,10 then 0,0,20 then 0,0,30.

Now, what if you have an enemy that is 2 units wide and is standing at 0,0,25? Your bullet will have to hit between 0,0,24 and 0,0,26 to hit him. It will surely miss if it is traveling at a rate of 10, (hence the numbers in bold above) and you can't slow the bullet down to "move object bala, 1" because then it will travel reeeeeeaaaaalllly slow....

At this point you would probably get frustrated... but thankfully, someone pointed you towards "Sparky's Collision DLL" (me ) and mentioned that you should look into "raycasting" for figuring out bullet collisions. This will open up quite a few doors, and may even be a step towards programming enemy AI to find the player based on sight and many other useful... erm, uses. Not only can you tell what object was hit, but you can even get the X, Y, and Z values of the precise point of collision. Could be very useful for leaving bullet holes, placing explosions, possibly making waypoints, and etc. With a little coding, you can even set it up to shoot through multiple targets, through walls, and other things.

Quite handy, indeed! I know this is quite a long winded post, but I am about to go home from work and am giddy with the knowledge that I have a weekend off from work and family. Hopefully, though, you can look into Sparky's Collision to help you with firing bullets. I am sure it will benefit you in the long run.

My green thumb grew the tree my Trojan War horse was crafted from. With roses in our pockets we rally round the tombstones. Ashes to ashes, we all fall down.
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 22nd May 2010 05:06
@CoughMist

Great info, I have "Sparky's Collision" Will look into raycasting ive read a few small things on it but never thought about it much. Also have "Dark AI" - "Dark Physics" etc. bought the package deal so going to look into bullet fire threw "physics" also. But from my understanding dark ai and phy don't like to play nice lol


P.S I love long winded post, Normally you get some great advice from them. Im getting the hang of this stuff fairly well, Lots of info on these forums.

======================================

Login to post a reply

Server time is: 2024-09-28 18:24:45
Your offset time is: 2024-09-28 18:24:45