Question: I've made a unity code that works but why does my character keep floating away even after I ' m no longer pressing keys below
I've made a unity code that works but why does my character keep floating away even after Im no longer pressing keys below is my code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
const float speed f;
Vector velocity;
Start is called before the first frame update
void Start
velocity speed new Vectorfff;
Update is called once per frame
void Update
if InputGetKeyw
velocity new Vectorvelocityx speed, f;
else if InputGetKeya
velocity new Vector speed, velocity.yf;
else if InputGetKeys
velocity new Vectorvelocityx speed, f;
else if InputGetKeyd
velocity new Vector speed, velocity.yf;
transform.position transform.position velocity Time.deltaTime;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
