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 / gun movement

Author
Message
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 13th Apr 2005 20:15 Edited at: 13th Apr 2005 20:16
ok, ive been having problems with this for a long time, i want to have a gun but placed at the side of the character, not straight infront, i could just lock on the positions but then the bullet doesnt come from there, so i used the code from the examples (the smooth curve camera code) and instead of doing it with the camera i did it with the gun, now i can make the bullet come from it, but the gun never stays in the same place, and i cant make the gun tilt up and down coz when the camera's facing the other way it turns the wrong way.......

In short words: can anyone help me position the gun to the side AND make the bullet come from it?

EDIT: Its a first person shooter just so u know...

thanks

"Well, if he dies, it'll teach him not to do it again." - Me
Feugsy
20
Years of Service
User Offline
Joined: 1st Nov 2004
Location: Australia
Posted: 14th Apr 2005 23:21
gday

you could set the object offsetted (i know you can do this in truespace 3.2) and rotate it off the center of the camera maybe. as for the bullet you would probably have to play around to do something like that

heres an example though

if bulletfired=1
position object camerax,cameray,cameraz
rotate object camera angle x, camera angle y, camera angle z (or you can put 0 for angle z which is probably better off)
turn object right (bullet),90
move object (bullet),(how much to the side you might need to experiment here)
turn object left (bullet),90

this should position the bullet where you want it. if this isnt clear email me and ill clear it up for you

ps: without offsetting the guns position it might not work

pps: i have actually tried this in my game and it works to an extent

cheers

Timespliiters 2 rocks!
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 15th Apr 2005 00:46
doesnt work

"Well, if he dies, it'll teach him not to do it again." - Me
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Apr 2005 03:21
Yes i once got that prob too.
I believe there's a forum where they recommend of starting the bullet at the same position of your camera and moving it so fast it can't be seen by the camera.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 15th Apr 2005 04:36 Edited at: 15th Apr 2005 04:39
hey, that's a good idea, i dont like seeing my bullet anyway

edit: when you say you "once" got that problem, does that mean you could fix it? if so....please tell me how, the other way doesnt work

"Well, if he dies, it'll teach him not to do it again." - Me
Feugsy
20
Years of Service
User Offline
Joined: 1st Nov 2004
Location: Australia
Posted: 15th Apr 2005 17:52
if you did not want to see your bullet you could always hide it and save alot of trouble.

Timespliiters 2 rocks!
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 15th Apr 2005 19:25 Edited at: 15th Apr 2005 19:28
now i noticed that it looks kinda crap, but im bored with just a round bullet that goes dead slow, what i mean is that i wanted to see the bullet flashing out of the gun...*not now alastair, your still not good enough*...bleh

EDIT: Oh yeah, i forgot to say, without locking on the guns position, how do i make it turn round the x axis with the camera(so if i look up its still there), it does it fine when i face one way, but when i turn 180 deg, it turns the wrong way

"Well, if he dies, it'll teach him not to do it again." - Me
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Apr 2005 17:04
You want to make your bullet flash out of your gun right?
Just make a special effect on the moment you shoot.
You know... plains...
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Apr 2005 17:06
By the way... if you are using my way bullet-positioning. You CAN use the "lock object on" command.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 16th Apr 2005 22:08 Edited at: 16th Apr 2005 22:10
ah cool, ill try that, thanks

edit: does this mean that u dont even have to have a bullet object, just a bunch of changing coordinates?

"Well, if he dies, it'll teach him not to do it again." - Me
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 16th Apr 2005 22:13
damn.....i tryed that but just lead me into a problem i forgot about, it makes part of the gun appear infront of parts that it shouldn't be. any ideas about how to stop that?

"Well, if he dies, it'll teach him not to do it again." - Me
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 17th Apr 2005 03:55
Zotoaster,

I come to the same problem with Euler rotation as you. That if I'm facing at 0o on the Y axis and my gun is angled at 45o(upward slant) on the X axis, as I turn the player on it's Y axis, though I technically have not rotated the gun myself, it will rotate downward. So, when I am faced at 180o on the Y axis, my gun is pointing at ,I say about 135o(downward slant).

+NanoBrain+
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 18th Apr 2005 01:33
nah, my problem is slightly different, i can turn it with the camera round the Y axis, but if im facing straight and turn the camera round the x axis, the gun does too, but if im turn 180o round the y axis and turn round the x axis, the gun goes the opposite way

"Well, if he dies, it'll teach him not to do it again." - Me
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 18th Apr 2005 05:12
Zotoaster,

I am speaking of the same problem. Read my post again.

+NanoBrain+
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 19th Apr 2005 02:47 Edited at: 19th Apr 2005 03:39
ah yeah, i must've not read it properly, sorry

Edit: Since I'm here Id also like to ask soething else...
uhh, ok, im not using bullets (well i am, but you just cant see it), but id like to somehow change that, like, just make coordinates that always change when you shoot, coz if i use a bullet and just do "Move object 4,10000" or w/e, it sorta skips over 10000 places all the time (i think) and makes it sort of tricky to shoot the enemy...and i also dont like it how it can only go a certain distance.....so how would i make a bunch or coordinates that always change instead of using a bullet, AND make it go an infinite distance and while these coordinates are changing you can shoot again?

"Well, if he dies, it'll teach him not to do it again." - Me

Login to post a reply

Server time is: 2025-05-23 13:11:33
Your offset time is: 2025-05-23 13:11:33