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 / question about automatic rotation positioning...

Author
Message
Chierin
16
Years of Service
User Offline
Joined: 6th Feb 2008
Location:
Posted: 13th Apr 2008 06:59
ok, so, my situation is as follows....my player is facing one direction. I want him to face towards a point somewhere else. I know the coordinates of the point. I want to know how to make my player rotate to face the point. I am using a simple dbPointObject() method right now for debugging purposes, and everything else works in my A* pathfinding, but i dont want my little guy to simply jump to facing the right direction.

I was thinking of trig, using dbACOS to find the angle between my current heading and the heading i want to end up at, and the distance formula allows me to find the "hypotenuse" of my little triangle, but i cant figure out how to find how far straight ahead i need to move before i would be at a right angle to the point i am trying to reach.

thats hard to describe without a picture, sorry about that.

anyway, there has to be an easier way to simply incrementally turn towards a destination every frame.

any help would be appreciated.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 13th Apr 2008 20:45
In DBPro there's the CURVEANGLE and CURVEVALUE commands. Is there something equivalent in GDK?

Login to post a reply

Server time is: 2024-09-29 17:27:44
Your offset time is: 2024-09-29 17:27:44