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 / Rotation help in DBP

Author
Message
CrashOV
20
Years of Service
User Offline
Joined: 1st May 2004
Location:
Posted: 11th Sep 2004 22:19
Hi,

I'm fairly new to Dark Basic, meaning that I've tried it once a couple years back and then left it on the shelf at home, but now I am trying it and I have trouble rotating my object. This is probably because of a mistake in the code probably because I've overlooked something or just dont understand something. I've heard about the pitch,roll bug but I thought it was fixed in version 5.6.

Anyway what I'm trying is this:
If leftkey()=1 then turn object left 1, wrapvalue(Object angle y(1)-5)

This however doesnt make the object turn, same goes for pitch and roll of the object. I've also tried yrotate, xrotate and zrotate to get my object to do freeflight movement, but U can probably already guess that didnt bring the desired movements neither (except for maybe the xrotate)

Anyway, any suggestions would be nice, I've been trying to figure out this problem for a day and a half now.
Zokomoko
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 11th Sep 2004 22:55
you should post more of the code.
if leftkey()=1 then turn object left 1,10
this should work.

if leftkey()=1 then yrotate object 1,object angle y()+10
this should work.

make sure you have sync in every loop, that you put those lines in your main loop, and that you're actually pressing the left key
CrashOV
20
Years of Service
User Offline
Joined: 1st May 2004
Location:
Posted: 12th Sep 2004 01:56
Thanks lots
It seemed that the first If line you posted was what I needed. I was calculating Object angle y + 10, but U just put in 10. I didnt realise that with the turn, pitch and roll commands it already calculated that by itself, which is probably why my object wasnt moving correctly.

This was my main loop:

Do

Rem ****Control input****

Rem Keyboard Control input
If keystate(78)=1 then move#=move#-1
If keystate(74)=1 then move#=move#+1
If upkey()=1 then xrotate object 1,wrapvalue(object angle x(1)+10)
If downkey()=1 then xrotate object 1,wrapvalue(object angle x(1)-10)
If keystate(211)=1 then roll object left 1, wrapvalue(object angle z(1)+10)
If keystate(209)=1 then roll object right 1, wrapvalue(object angle z(1)-10)
If leftkey()=1 then aY# = Wrapvalue(aY#-5)
If rightkey()=1 then aY# = Wrapvalue(aY#+5)
If move#=>0 then move#=0
If move#=<-25 then move#=-25
move object 1,move#

Rem Refresh Screen
Sync
Loop

But I changed it now and it works. thanks again
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 13th Sep 2004 01:15
Remember that DBPro uses Euler angles and these can often confuse people unfamiliar with them. A good solution is to use WOLF's EZrotate plugin. There is a free version and a commercial version.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home

Login to post a reply

Server time is: 2024-09-23 00:26:29
Your offset time is: 2024-09-23 00:26:29