|
Hi Guys, The question I have about this is more geared toward the math... as I have not been able to nail down the correct formula for rotating the turret of my tank. First, I DO have rotation working across an authoritative server/client configuration so that is not the problem I am having. The problem I am having, is the point at which the calculates the rotation from. The player can move using the standard WASD and it is top down. The player uses the mouse to "Aim" the turret of the tank(no rotation speed, it simply snaps to place) and it should point toward the mouse location based on the mouse position on the screen, and I think that is where I am running in to problems. I guess lets just post the code instead of me rambling.
As you can see there are a lot of commented out lines, as I have been trying everything. And what is happening is the "point" at which it calculates the rotation is down and to the left(screen wise) from the center(where the player is). I assume it is because the server "screen" sees something different. Any help on this is appreciated. Thank you EDIT: I don't know that it makes a difference, but the server is running in Batchmode. It might because as i recall before we started running it like that, it worked ok.
(comments are locked)
|
|
If your problem concerns only with
then you can apply the following Wiki script to your turret: http://www.unifycommunity.com/wiki/index.php?title=LookAtMouse
(comments are locked)
|
|
It looks like the problem is that the mouse position is in screen coordinates, while you game is running in "world" coordinates. You have to convert the mouse position into world coordinates before you do anything with them. i.e.
(comments are locked)
|
