i am making a rigid body controller and this is happening
these are the errors here
Assets\RigidBodyMovement.cs(31,68): error CS1061: ‘RigidBodyMovement’ does not contain a definition for ‘velocity’ and no accessible extension method ‘velocity’ accepting a first argument of type ‘RigidBodyMovement’ could be found (are you missing a using directive or an assembly reference?)
Assets\RigidBodyMovement.cs(31,20): error CS1061: ‘RigidBodyMovement’ does not contain a definition for ‘velocity’ and no accessible extension method ‘velocity’ accepting a first argument of type ‘RigidBodyMovement’ could be found (are you missing a using directive or an assembly reference?)
my script is here
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RigidBodyMovement : MonoBehaviour
{
private Vector3 PlayerMovementInput;
private Vector2 PlayerMouseInput;
[SerializeField] private Transform PlayerCamera;
[SerializeField] private RigidBodyMovement PlayerBody;
[Space]
[SerializeField] private float Speed;
[SerializeField] private float Sensitivity;
[SerializeField] private float JumpForce;
// Update is called once per frame
void Update()
{
PlayerMovementInput = new Vector3(Input.GetAxis(“Horizontal”), 0f, Input.GetAxis(“Vectical”));
PlayerMouseInput = new Vector2(Input.GetAxis(“Mouse X”), Input.GetAxis(“Mouse Y”));
MovePlayer();
MovePlayerCamera();
}
private void MovePlayer()
{
Vector3 MoveVector = transform.TransformDirection(PlayerMovementInput) * Speed;
PlayerBody.velocity = new Vector3(MoveVector.x, PlayerBody.velocity.y, MoveVector.z);
if(Input.GetKeyDown(KeyCode.Space))
{
GetComponent().AddForce(Vector3.up * JumpForce, ForceMode.Impulse);
}
}
private void MovePlayerCamera()
{
}
}