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.

DarkBASIC Discussion / Er..... this might be an obvous question but need confirmation

Author
Message
vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 3rd Apr 2007 01:24 Edited at: 3rd Apr 2007 02:43
Hi yes erm... do I have to have some type of attachment to the player for shooting every time that will carry the bullet as I get things to shoot but only in one position.

I just need comfirmation whether this is so or at least attach it to the limb of a vehicle like a tank gun or players guns model?
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 3rd Apr 2007 04:09
Quote: "that will carry the bullet"


Will what carry the bullet?

I for one don't understand your question - sorry.

Can you explain in a little more detail?

TDK_Man

vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 3rd Apr 2007 08:02
The player's or NPC 'S gun or tank or vehicle or plane or spaceship
TDK
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 5th Apr 2007 19:01
When you shoot something, that 'something' has a starting X,Y,Z position in 3D space.

It sounds like you aren't updating this position as your tank or whatever moves around.

TDK_Man

vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 6th May 2007 10:36 Edited at: 16th Jul 2007 15:32
Sorry TDK Man for not replying so soon, can't I put the actual shooting element on a limb of the tank say the main gun barrel and have it shoot wherever I drive the tank?
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th May 2007 22:13
your bullet should not be attached to the model in any way. Get the direction the gun barrel is facing and store that in a property associated with the bullet. Then assign your bullet's starting position to match the tip of the gun barrel. Then start moving the bullet, which should be independent of the tank at this point.

amountOfBullets = 10
dim bullets(amountOfBullets,8)

The second dimension of 8 would hold these values:
1 - x position
2 - y position
3 - z position
4 - x direction vector
5 - y direction vector
6 - z direction vector
7 - speed
8 - object number

The direction vector is the where the gun is pointed at the time you fire that bullet. (make sure the vector is normalized) Then you just move the bullets in the array.




vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 17th May 2007 03:33 Edited at: 17th May 2007 03:36
oh I see thanks Phaelax, the thing is how would I do this for say every tnak and plane and vehicle both friendly and enemy? th same way?
vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 16th Jul 2007 15:33
Sorry I think I see how to now thanks

Login to post a reply

Server time is: 2026-07-06 06:44:55
Your offset time is: 2026-07-06 06:44:55