Dear all I have a problem on coding Rigidbody
movement, please help.
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
[DebuggerDisplay($@"{{{nameof(DebuggerDisplay)}(),nq}}")]
public class NewBehaviourScript : MonoBehaviour
{
public float yaw = 0.0f, pitch = 0.0f;
private Rigidbody Rb;
[Serializefiled] float walkspeed = 0.0f, sensitivity = 2.0f;
void Start()
{
Cursor.lockstate = CursorLockMode.Locked;
rb = gameobject.GetComponet<Rigidbody>();
}
void Update()
{
if (!Input.Getkey(keycode.Space) || !physics.Raycast(rb.tranform.position, Vector3.down, 1 + 0.001f))
{
}
else
rb.velocity = new Vector3(rb.velocity.x, 5.0f, rb.velocity.z);
Look();
}
private void Fixedupdate() => Movement();