Question by
BardoBot · May 11, 2020 at 08:24 AM ·
scripting problem
how to make camera related movement with a rigid body ?
heres my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float speed;
public Rigidbody rb;
Vector3 movement;
// Update is called once per frame
void Update()
{
movement.x = (Input.GetAxis("Horizontal"));
movement.z = (Input.GetAxis("Vertical"));
}
void FixedUpdate()
{
rb.MovePosition(rb.position + movement * speed * Time.deltaTime);
}
}
Comment
Your answer
Follow this Question
Related Questions
Animation plays for a second 0 Answers
i have a problem with StartCoroutine and float 0 Answers
error CS0103 the name anim does not exist in current context 0 Answers
ThiirdPersonController Movement in midair! 0 Answers
[SOLVED]Need OnTriggerEnter Help 2 Answers