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 / Move object in facing direction

Author
Message
UndeadDragon
15
Years of Service
User Offline
Joined: 15th Aug 2009
Location:
Posted: 16th Aug 2009 01:55
Hi, I just started with Dark GDK today and I have come across my first problem which I can't solve.

I have made a basic movement system, which loops an animation whilst walking and moves forwards and backwards, but when I press Left and Right I want it to rotate the object (which I can do), but I would then want to move forwards and backwards in the new direction that the object is facing.

How would I achieve this?
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 16th Aug 2009 02:38
I'm pretty sure dbMoveObject will move an object forward relative to it's angle.

Use Google first... it's not rocket surgery!
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 16th Aug 2009 03:12
^ THAT is one of the most useful functions I have ever met! It is sooo damn useful for a lot of things. It stops you using matrices and vectors to move objects


Your signature has been erased by a mod
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 16th Aug 2009 04:03
If you don't want to use dbMoveObject you can use this code to move your object forward:


To move the object faster multiply the dbSin and dbCos results by a number.

Use Google first... it's not rocket surgery!
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 16th Aug 2009 11:49 Edited at: 16th Aug 2009 11:50
If you have trouble with dbMoveObject, try turning your object with dbTurnObjectLeft and dbTurnObjectRight(as opposed to dbRotateObject).

There are two types of movement(rotation) free-flight and euler and they are not compatable.

It kind of tells you in the documentation but it is far from clear.
UndeadDragon
15
Years of Service
User Offline
Joined: 15th Aug 2009
Location:
Posted: 16th Aug 2009 23:17
Thanks. That dbMoveObject() is a really useful function

I have come across another problem now. When my object rotates in a direction, my camera also rotates, but it rotates from where it's position. I would like it to "pan around" my object, so it is still directly behind it. What would be the easiest way to achieve this?

Login to post a reply

Server time is: 2024-10-01 10:20:26
Your offset time is: 2024-10-01 10:20:26