Simulating isometric engine in 3d
Posted 20 May 2004 - 01:27 PM
Posted 22 May 2004 - 06:34 AM
(BTW, by up and down do you mean +y/-y or +z/-z)?
To move up and down you'd just need to modify the y axis.
You'll need a vector that points straight into the scene (direction vector) to move forwards and backwards, and you'll need either a vector that points left or right (a leftVector or a rightVector). A leftVector is not a vector in the negative x direction, a rightVector is not a vector pointing in the positive direction and a direction vector is not one that points down the z axis.
To calculate the direction vector you'll need a point that the map is at (the currentPosition of the map), and any point that is straight down the scene (this will be your lookAt point), then subtract lookAt from currentPosition and you'll have your direction vector which you then should normalize.
To get the right vector, you take the cross product between the up vector and the direction vector and then you'll have the right vector.
now to move left (using the right vector) you set an amountToMove variable that will say how much to move right. You then
// CurrentPos is the position of the map.
currentPosition.x += mvXZAxis.x * amountToMove;
currentPosition.z += mvXZAxis.z * amountToMove;
If you want to move left you just negate the amountToMove variable.
I'm not really sure if you are working in 3 axes or 2 axes. I assume you're working with 3D coordinates and trying to get a Final Fantasy Tactics type of engine going, If not, then of course all the above wont work as it is.
Posted 22 May 2004 - 12:40 PM
Posted 22 May 2004 - 03:57 PM
Posted 23 May 2004 - 07:54 AM
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users