Привет, помогите пожалуйста с ошибкой. Так как мало опыта с сишке, не имею понятия, почему возникает эта ошибка. Спасибо!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
[SerializeField]
private float moveSpeed = 1f;
[SerializeField]
private float jumpForce = 10f;
[SerializeField]
private float fallMultiplier = 2.5f;
[SerializeField]
private float lowJumpMultiplier = 2f;
private Rigidbody rb;
private bool doJump = false;
private bool isJumping = false;
void Awake()
{
rb = transform.GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update() {
if(Input.GetButtonDown("Jump") && !isJumping) {
doJump = true;
isJumping = true;
}
}
// FixetUpdate is called once per fixed Timestep (50 times/second default)
void FixedUpdate()
{
Vector3 moveVect = Vector3.forward;
moveVect = moveVect.normalized * moveSpeed * Time.deltatime;
rb.MovePosition(transform.position + moveVect);
if(doJump) {
rb.AddForce(Vector3.up * jumpforce, ForceMode.Impulse);
doJump = false;
}
if(rb.velocity.y < 0) {
// multiply fall gravity
rb.velocity += Vector3.up * Physics.gravity.y * (fallMultiplier - 1) * Time.deltatime;
} else if(rb.velocity.y > 0 && !Input.GetButton("Jump")) {
rb.velocity += Vector3.up * Physics.gravity.y * (lowJumpMultiplier - 1) * Time.deltatime;
}
}
void OnCollisionEnter(Collision other) {
if(other.gameObject.CompareTag("Ground"))
isJumping = false;
}
}
Ошибка: 'Time' does not contain a definition for 'deltatime'