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.

Dark GDK / Rotating object and moving forward in the direction it's facing

Author
Message
haYnguy
16
Years of Service
User Offline
Joined: 5th Jun 2008
Location: on my island
Posted: 20th Jun 2008 06:57
I'm having trouble figuring out a way to rotate a ship around it's Y axis and then having it move forward in the direction it is facing.

can anyone guide me in the right direction? i'm sorry for the pun

-- from my island, aloha wau 'ia 'oe --
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 20th Jun 2008 07:19 Edited at: 20th Jun 2008 07:21
Assuming "math.h" is included you can just:



and remember that these angles are in radians, if your 'yAngle' is in degrees then just * 0.0174532925f to make it radians.

Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 20th Jun 2008 09:40
dbRotateObject(objID,dbObjectAngleX(objID),dbObjecdbObjectAngleY(objID)+1,dbObjecdbObjectAngleZ(objID));
dbMoveObject(objID,1)

Should work

System
MacBook Pro
Windows XP Home on Boot Camp
haYnguy
16
Years of Service
User Offline
Joined: 5th Jun 2008
Location: on my island
Posted: 21st Jun 2008 23:26
ok. something isn't working. the ship doesn't move in the direction it is facing.

-- from my island, aloha wau 'ia 'oe --
Jonas
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 25th Jun 2008 03:44
Look up the dbNewXValue(), dbNewYValue(), and dbNewZValue() functions.

P4 3.4ghz/2gb RAM (+PF=24gb)/GeForce 6200 A-LE 256meg AGP8x (Altered for 16pipelines, 768mb forced TurboCache-ish)/WinXP Pro/74gb WDRaptor(SATA,OS)/3x 200gb WDCaviar(IDE)/250gb WDCaviar SE16(SATA)
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 25th Jun 2008 07:31
I of course meant * ( 180.0f / pi ), and not its inverse :p.

haYnguy
16
Years of Service
User Offline
Joined: 5th Jun 2008
Location: on my island
Posted: 28th Jun 2008 07:46
Quote: "dbRotateObject(objID,dbObjectAngleX(objID),dbObjecdbObjectAngleY(objID)+1,dbObjecdbObjectAngleZ(objID));
dbMoveObject(objID,1)

Should work"


and it absolutely did. thank you so much

-- from my island, aloha wau 'ia 'oe --
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 28th Jun 2008 19:09
Your welcome

System
MacBook Pro
Windows XP Home on Boot Camp
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 30th Jun 2008 23:54
Remember - You might have a rotate + fix pivot yet to implement.

Is your ship "almost working" but flying up - or right always? If so, it could be you need to rotate the thing to make it so the FRONT you want really becomes the FRONT - you rotate to desired angles, then call fixpivot (dbFixObjectPivot or something)

then you might be a bit closer to what you're looking for.
--Jason

Login to post a reply

Server time is: 2024-09-30 01:35:10
Your offset time is: 2024-09-30 01:35:10