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 / AHHHHH!!!!!! WHY WONT IT GO WERE I WANT!!!!!!!!!!!!!!!

Author
Message
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 11th May 2004 21:50

Im trying to get this turret to point at the layer unit. so far i can get the main turret to spin aroun its y axis to face the ship but it wont point the gun barrel corretly. When im infront of the tank it will, but when im behind it the turret move opposite what it should. IE if it needs to pitch up 10% it will pitch down 10%. Here is the function:
FYI to make it easyer to read i left out naming the variables so
t=main turret
c= cannon
1=player



AKA Drunken French Munk (the name i use at home)
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 12th May 2004 04:38
Two different plans of attack you can try. One, use limbs so everything stays relative to each other. Two, use Wolf's EZ Rotate plugin which has better rotation commands for this task. You want relative rotation not DB's global rotation.
--
TAZ

DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 12th May 2004 21:42
oops lol the code wasnt added.

im not sure limbs wold work. Yous see what im doing is first saving values, then pointing the turret at the target (usding point object command) then i tell it to revet to the old x & z, but keep the new y. then i order the cannon object to use the new y and new x.


here is the code:
t=main turret
c= cannon
1=player

function tpoint()
for a= 1 to aoet(1)
t=a+800
c=a+700

ppx#=object position x(1)
ppy#=object position y(1)
ppz#=object position z(1)

th#=object position y(1)

ox#=object angle x(t)
oy#=object angle y(t)
oz#=object angle z(t)

point object t,ppx#,ppy#,ppz#
`point object c,ppx#,ppy#,ppz#

nx#=object angle x(t)
ny#=wrapvalue(object angle y(t)+180)
nz#=object angle z(t)

cx#=newxvalue(object position x(c), ny#, 5)
cz#=newxvalue(object position z(c), ny#, 5)

set cursor 0,0
print ny#

if ny#<90
if ny#<270
nx#=Wrapvalue(nx#+180)
endif
endif

rotate object t,ox#,ny#,oz#
rotate object c,nx#,oy#,nz#

next a
endfunction

AKA Drunken French Munk (the name i use at home)
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 13th May 2004 00:03
Quote: "oops lol the code wasnt added."


Incorrect. Click on the source button at the bottom of your first post.
--
TAZ

DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 13th May 2004 21:16
i c
ive been realy out of it this week.
lol

AKA Drunken French Munk (the name i use at home)

Login to post a reply

Server time is: 2024-09-22 09:38:23
Your offset time is: 2024-09-22 09:38:23