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 / attach cube to camera

Author
Message
Xoddam
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location:
Posted: 15th Mar 2009 03:02
I am trying to attach a cube to the camera but every time I do, the cube just dissapears.

the code snippet...

dbMakeObjectCube(21,1);
dbSetObjectCollisionOff(21);
dbPositionObject(21,0,0,0);
dbFixObjectPivot(21);
dbDisableObjectZDepth(21);
dbSetObjectToCameraOrientation(21);
dbPositionObject(21,10,10,0);

when I add the last line, the cube orients itself to the world instead of to the camera... I am obviously doing something wrong, could you help me to see what?
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Mar 2009 11:21 Edited at: 15th Mar 2009 11:21
dbAutoCamOff();

try that, it should work
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 15th Mar 2009 11:33 Edited at: 15th Mar 2009 11:35
Or make sure to use the commands during runtime and not before.

I'd also suggest you use a constant to replace 21, as it may make perfect sense now, but will be impossible to know a few thousand lines from now what the hell 21 is.

So:
const int Object = 21;

dbSetObjectToCameraOrientation( Object );
dbPositionObject( Object , dbCameraPositionX(), dbCameraPositionY(), dbCameraPositionZ() );


I wrote this without reference. You might have to add a "0" to the camera functions.
Xoddam
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location:
Posted: 15th Mar 2009 23:57
so entomophobiac, did you mean to put the dbPositionObject(.... into the while loop?
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 17th Mar 2009 13:28
Both of the commands, not just the positioning. Especially if the position of the camera will change during runtime.
Xoddam
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location:
Posted: 26th Mar 2009 01:36
entomophobiac that was what i was doing wrong. thanks so much for your help

Login to post a reply

Server time is: 2024-09-30 21:25:45
Your offset time is: 2024-09-30 21:25:45