x


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!

more ▼

asked Sep 25 '10 at 08:42 PM

Matthew 1 gravatar image

Matthew 1
41 1 1 4

Why don't you post the script you have at the moment so it's easier to help you?

Sep 26 '10 at 12:18 AM Will 7

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.Move would move you and transform.Rotate would turn without moving.

Sep 28 '10 at 07:42 PM skovacs1

on the smooth follow script, CRANK up the rotation damping. your character wont turn to face the camera.

Jan 27 at 11:31 PM TRiToNDREyJA

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....

Jan 28 at 03:58 AM alucardj
(comments are locked)
10|3000 characters needed characters left

2 answers: sort oldest

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).

more ▼

answered Jan 28 at 12:58 AM

Gizmoi gravatar image

Gizmoi
255 2 6

(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Jan 28 at 04:42 AM

PAHeartBeat gravatar image

PAHeartBeat
211 3 4

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2994
x1366
x1041
x322

asked: Sep 25 '10 at 08:42 PM

Seen: 613 times

Last Updated: Jan 28 at 04:42 AM