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 a camera behind an object using Trig.

Author
Message
8BitTonberry
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location: Atlantic Canada
Posted: 9th Feb 2010 05:08
Hello! I'm designing a space shooter game, and I'm trying to position my camera behind the ship. Basically, wherever the ship is pointing, I need the camera to be in the opposite direction(+180 with a dbWrapValue, most likely.) and at a set distance. The distance is the Hypotenuse/Radius, and the angles are based off of the objects angles.

Any help?

Here's my progress.
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 9th Feb 2010 19:06
This should be in the darkGDK forum, Shouldn't it?

How about just saying "rotate camera object angle x(1000)+180, angle y(1000)+180, angle z(1000)+180" In your do loop? I use DBPro but it should be almost the same in GDK.

---
8BitTonberry
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location: Atlantic Canada
Posted: 10th Feb 2010 01:24
Eh, that would only get it pointing in the right direction.
I can get it pointing to the right spot, it's just a matter of positioning it in the right place.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 10th Feb 2010 11:48
Position the camera in the same place as your object, then use dbSetCameraToObjectOrientation(), then use dbMoveCamera() to move it backwards the distance required.

Here's a thread for Newtonian flight, just in case it may be useful:
Newtonian flight

8BitTonberry
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location: Atlantic Canada
Posted: 11th Feb 2010 02:05
Awh, thank you so much for the reply.

I had figured that out a few hours after your reply.

Had I checked here, I would've gotten it sooner, I guess my own ambitions got me the answer sooner than my dependence on others. Thank you very much though, I really do appreciate it.

Login to post a reply

Server time is: 2024-10-01 23:26:03
Your offset time is: 2024-10-01 23:26:03