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 / Issue with Array Vs. Camera Angle

Author
Message
hisdudeness21
13
Years of Service
User Offline
Joined: 6th May 2011
Location: Pittsburgh
Posted: 27th May 2011 20:00
I'm working a little code snippet that alters matrix height using cosine to create a water-like effect. I also wrote a function for camera movement not using the wrap angle commands, because I wanted to work out the formulas myself.

I created an array that stores the various heights of the matrix and then updates the matrix accordingly. For some reason, the camera will not move in the right direction when I do this. I've narrowed it down to assigning the values to the different components of the array. When I created a regular variable storing the temporary height in order to update the height of the tile, or just directly plug in the value in the dbSetMatrixHeight command, the camera moves as it should. The correlation between the array and camera angle does not make much sense to me and was wondering if anyone has experienced this before or knows what's going on?

And for reference, here's my code:
DeadTomGC
14
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 28th May 2011 06:31 Edited at: 28th May 2011 06:39
I have yet to finish looking over your code, but Just to let you know I've done that exact thing. Anyway, I just noticed that you are using the sin and cos functions and are having to convert to rads. Why not use dbSin and dbCos so that you don't have to do this?

Edit:
I went though the same thing you are doing with the camera but in 3 dimensions, and I'll tell you, It gets messy. I could give you the formulas for moving a camera according to its rotation, but it would be easier to use the build in functions for moving the camera which I didn't know about. dbMoveCamera

This function only moves the camera Forward and backwards, but if you rotate the camera 90 deg. move and then rotate -90 deg you will move side to side.


Login to post a reply

Server time is: 2024-11-19 10:29:35
Your offset time is: 2024-11-19 10:29:35