| 03-04-2004, 03:32 PM | #1 |
I have been working on an fpv (first person view) for some time now. And I have now figured out a way to determine the height of a variable point on the map. But I still need determine the angle of attack of the camera. When the unit is walking up a mountain the camera should face a bit upward. The camera currently only moves along up with the unit while remeaning to point exactly forward (into the mountain) instead of pointing along with the angle of the mountain (what a normal human would do). This looks pretty messy ingame. o_O My guess was to compare the height of a point in front of the unit with a point behind the unit. This would give me the angle between those points, which is exactly what I need. ^_^ But which points should I use? And how do I determine them?! I need a formulae which represents the direction where the unit is facing through a line, this way I can easily pick a point in front and behind the unit. Now the standard formulae for a strait line is Y-B = (X-A) multiplied by a constant. Now the constant determines the angle of the line and B and A determine the location of the line on a grid. From the game I can only retrieve the X and Y of a unit and the angle it is facing. Inserting X and Y into the basic straight line formulae is no problem, they are inserted where A and B stand. But converting the facing angle to a constant is proving more difficult. I thought I could do this by using tangens. So I would get this formulae: Y = (X-(X of unit)) multiplied by tangens(facing of unit) + (Y of unit) But this formulae isn't any good :(, cause what would happen if the unit facing becomes 0 or 180? tangens 0 and 180 outputs 0. This means that X is multiplied by 0 and that the valua of X has no meaning, while this should not be the case :\. When the unit facing is 0 or 180 we should get a vertical line, in which the valua of Y has no meaning. Well.. I guess my story seems rather difficult to understand, I have really tried to explain it properly but this is just very hard :(. I hope someone out there understands and is able to help me with this. Thanks, Remy. |
| 03-04-2004, 04:49 PM | #2 |
well...you could get the points just infront and behind the unit using a polar offset (sorry if this does not help, i did not understand very well). PS: How did you work out the height??? |
| 03-04-2004, 08:42 PM | #4 |
Semi offtopic, I just reformatted, so I need that program that extracts the height map again, could you link me to it? |
| 03-05-2004, 03:37 PM | #5 | |
Quote:
Sorry I don't know where to get it, I'll give it to next time when you come online, exactly when you will give me the 10x better turning system ;) Remy out. |
| 03-05-2004, 03:42 PM | #6 | |
Quote:
Now as I already explained, polar offsets will not work. Why are you offsetting by 32? this would only work if the unit is exactly in the middle of the tile and when he is facing 0,90,180 or 270 degrees. Polar offsets do not help me. They do not provide the points that cross with a grid line and the line that represents the facing of the unit. Please, Remy. |
| 03-06-2004, 03:50 AM | #7 |
I've been messing around with this so long, I hardly remember what ive done, but here is the map. Turning works, andI have some AoA judging 'stuff' in there, but It needs a nice coating of polish. I think I did it somehow by finding the length between the position of the unit in the tile and the point where it would cross a line nearby. I'm not sure anymore, for its late, if it works with the units facing. I think it does. Maybe this could help somehow. |
