- Home /
Newbie Question
Hey everyone,
I apologize for asking the most basic of questions here, but I've been at this for several hours and just can't wrap my head around it.
What I'm using: The move and camera scripts from the Lerpz demo. What I'm trying to do: Move my model only with the "W" and "S" keys (vertical axis). I want the model to rotate/controller to "turn" without moving using the "A" and "D" keys ( horizontal axis). Additionally, and this is the part thats giving me the most pain: I want the model to always "face forwards" so that it doesn't flip and face the camera.
Essentially, it's similar to a tank movement control, but I can seem to keep it all working. I've found some code with varying degrees of success and done a lot of the tutorials, but still not working too well.
Can anyone help with what tools I should be looking to, or any guides? As I'm trying to learn, I don't necessarily just want the JS and unity code.
Thanks!
Why don't you post the script you have at the moment so it's easier to help you?
This is 2 questions - 1 about controlling movement and another about controlling the camera. For the camera part, have you tried something like one of the smooth follow cameras or simply making the character a parent to the camera? For the movement controls, controller.$$anonymous$$ove would move you and transform.Rotate would turn without moving.
on the smooth follow script, CRAN$$anonymous$$ up the rotation damping. your character wont turn to face the camera.
How about you change the title of your question so that it actually describes the question. Something like trouble with Input Axis , am sure you would get more traffic than with your current title Newbie Question , that describes about 90% of the questions here....
Answer by Gizmoi · Jan 28, 2013 at 12:58 AM
Your best bet would be to parent the camera to your character, then have a script on your player that does as you describe.
W moves the player forward - transform.Translate(0,0,1, Space.self) - S moves backwards.
A and S rotate the player - transform.Rotate(0,10,0).
Answer by PAHeartBeat · Jan 28, 2013 at 04:42 AM
Hi
If you are using controller scripts of unity, your model / player will turn using mouse movement, In character have a mouse look up script to rotated player..... and as "TRiToNDREyJA" said Smooth Follow Script will make camera always see you model from it's back so user can see what happing his forward side.
If you want to face model to camera, you need to create a new other script for cam follow
Your answer
Follow this Question
Related Questions
MouseWheel Lerp Smoothing Problem 1 Answer
Camera relative movement 0 Answers
How can I align Axis? 0 Answers
Keep Camera from player at a certain distance while orbiting around player 2 Answers
character turning where he looks 0 Answers