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 / Keeping the head in View

Author
Message
Dragon Tiger Wolf Bald Eagle
16
Years of Service
User Offline
Joined: 5th Feb 2008
Location:
Posted: 6th Feb 2008 03:35
I have been working on making a camera follow a charecter a guy. All is done Exept I want the camera to Stay Behind the guys head when he turns around. But If I try to turn the camera with it it doesn't work. What is the best way To keep the back of the head in view as he rotates around? If you Have ever played Jedi Academy The camera there will stay behind the guy that is the type of things I already have the camera FOllowing him that is done I just need to know how to keep the back of his head in the camera while he rotates around.

example code

if (dbLeftKey()||dbRightKey()||dbUpKey()||dbDownKey())
{
dbLoopObject(2,236,259);
cmrax=dbObjectPositionX(2);
cmray=dbObjectPositionY(2);
cmraz=dbObjectPositionZ(2);
dbPositionCamera(cmrax,cmray+90,cmraz-100);


}
else
dbLoopObject(2,209,233);

if(dbLeftKey())
{
dbTurnObjectLeft(2,0.9f);

}
if(dbRightKey())
{
dbTurnObjectRight(2,0.9f);
}

The quality of what a man gives without seeking anything in return shows his integrity.
Chierin
16
Years of Service
User Offline
Joined: 6th Feb 2008
Location:
Posted: 6th Feb 2008 08:59
this is what i just did, because i was having the same issue. Im very new to darkGDK, so i doubt this is the best way to do this, but this is how i did.

Dragon Tiger Wolf Bald Eagle
16
Years of Service
User Offline
Joined: 5th Feb 2008
Location:
Posted: 6th Feb 2008 17:31
On some of your code you have rotate what number did you set for that? You know int rotate=1 or what ever what is the number?

The quality of what a man gives without seeking anything in return shows his integrity.
Dragon Tiger Wolf Bald Eagle
16
Years of Service
User Offline
Joined: 5th Feb 2008
Location:
Posted: 6th Feb 2008 18:24
Never mind I got it. Thanks for the help.

The quality of what a man gives without seeking anything in return shows his integrity.
Chierin
16
Years of Service
User Offline
Joined: 6th Feb 2008
Location:
Posted: 6th Feb 2008 18:31
well, it will rotate by whatever float you put in there, that many degrees. I have it set to two degrees, and it moves fluidly, but if you are coding a FPS or something, you might want faster or slower turn speeds, depending. later im going to work on actually setting it up to use dbMouseMoveX or dbMouseMoveY and some trig to I can turn using the mouse. not sure how that will work yet.

obviously i am just as new as you are, but the thing that helped me out the most is, if you go to the install folder for darkGDK on your computer, look at the documentation, there is a list of all the functions, and what they do and how to use them, and it helps a LOT. basically, i come to a problem in my code, and i browse through the documentation until i get some ideas on how to code it. at this point, its just about being creative. seeing some of the functions available to me gives me some ideas on what i can do to set up my game how i want it.

Login to post a reply

Server time is: 2024-11-20 01:37:06
Your offset time is: 2024-11-20 01:37:06