1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MArishka [77]
3 years ago
11

I just started game development using unity, I’m trying to control my sphere moving on a flat surface using the W,A,S,D keys, if

anyone knows the code for that using C# ,please help.
Computers and Technology
1 answer:
uysha [10]3 years ago
6 0

Answer:

Explanation:

public class Controlador: MonoBehavior

{

// we declare velocity variable, we can change the value to get more speed

public float velocidad = 3f;

void Start()

{

 

}

void Update()

{

// with this condition we select the key for the movement.

// for example the left arrow or the letter "a"

  if (Input . GetKey(KeyCode . LeftArrow) |I Input . GetKey("a"))

  {

    transform . position += Vector3 . left * velocidad * Time . deltaTime;

  }

   if (Input . GetKey(KeyCode . RightArrow) |I Input . GetKey("d"))

  {

    transform . position += Vector3 . right * velocidad * Time . deltaTime;

  }

   if (Input . GetKey(KeyCode . UpArrow) |I Input . GetKey("w"))

  {

    transform . position += Vector3 . up * velocidad * Time . deltaTime;

  }

   if (Input . GetKey(KeyCode . DownArrow) |I Input . GetKey("s"))

  {

    transform . position += Vector3 . down * velocidad * Time . deltaTime;

  }

}

}

You might be interested in
In this exercise, you'll raise a manual exception when a condition is not met in a particular function. In particular, we'll be
Shtirlitz [24]
Dhjejekewk that’s a lot
8 0
2 years ago
Two electronics technicians are looking at the testing instrument in the figure above. Technician A says that this instrument is
aleksklad [387]
I am pretty sure the answer is A.
4 0
3 years ago
Which of the following is a key component to your individual internet safety? government regulations
nexus9112 [7]
It is government regulations and acceptable use policy
3 0
3 years ago
Krystal recorded her times for all her cross-country meets this season. To sort her data showing the lowest times first, what wi
devlian [24]
Sort ascending would be the correct one, since you are going from the lowest value to the highest
3 0
3 years ago
Read 2 more answers
1. cybersquatting refers to the tampering of existing web sites and selling unrelated products (true or false)
Dmitrij [34]

Answer:

i think its 17

Explanation:

i rerwerwerwrwerewr

5 0
3 years ago
Other questions:
  • Why would an over the shoulder shot be used
    11·1 answer
  • If you are upgrading your operating system to Windows 7, you may not use the In-Place Upgrade Installation Option with
    14·1 answer
  • Write a program that asks the user to enter two dates (in YYYY-MM-DD format), and then prints which date is earlier. Your progra
    15·1 answer
  • David uses Office Excel 2013 to calculate his average marks. He enters a formula in cell B5 to calculate the average based on th
    11·1 answer
  • The third wave of computing was characterized by the introduction of _____.
    10·1 answer
  • How to create a distribution list in outlook?
    7·1 answer
  • The construction of a mixed media assemblage would be considered
    9·1 answer
  • A chemistry teacher colleague of yours uses video regularly in their courses, but commented to you about how much time it takes
    15·2 answers
  • People’s personal information is collected _____. Select 4 options.
    7·2 answers
  • ________ technologies are technologies that enable the incremental improvement of products and services.
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!