- Home /
Top-Down Shooter Motion
I started to work on a top down shooter where the player moves the mouse to aim in that direction. I wanted to have the player move up, down, left, and right an the when the WASD/ arrow keys are used, but it will only move in it's own x and y axis, so when you rotate the player half a rotation, D moves it left and A move it right. i can't figure out how to modify the current script i have (FPSWalkerEnhanced: http://unifycommunity.com/wiki/index.php?title=FPSWalkerEnhanced) to do this. Please help.
I presume you mean you want your player to move left or right relative to its current facing direction?
no i want it to move relative to world position, so when you hit up, the player moves up and likewise for the other directions
Answer by Seth-Bergman · May 02, 2012 at 05:02 AM
Sounds like you want the player to face where the mouse cursor is, while the movement is directly relative to world, rather than players rotation.. if so, I think just maybe eliminating this line (to keep the world coordinate system) just might do it:
moveDirection = myTransform.TransformDirection(moveDirection) * speed;
maybe... It pops up a couple of times, just delete them all, I think
edit: of course, if you want to keep the speed intact you should replace the line above with:
moveDirection = moveDirection * speed;
careless of me...
when you get rid of the TransformDirection() function the object doesn't move anymore. (it still rotates, but thats irrelevant) i need a function that moves the object and doesn't use something like myTransform.TransformDirection(moveDirection) or at least find a way to make a TransformDirection relative to world space
Answer by ProfArithmetic · May 03, 2012 at 01:29 AM
I have a project that I am working on that is a top down game as well so i know the confusion at first. I would recommend this link to a very good walk through of what a 2d top down shooter really is.
http://www.rebelplanetcreations.com/downloads/Other/Tutorials/HowToMakeAGameInUnity3D.pdf
Hope that helps
Your answer
Follow this Question
Related Questions
Unity2D AI for Top Down Zelda-Type movement 1 Answer
Enemy strafing AI Top Down 0 Answers
How can i move a game object up and down so it acts like a obstacle for my sphere player 4 Answers
Top down 2d character controller sometimes walking backwards 1 Answer
My top-down movement is really jittery, any idea how to fix? 1 Answer