getting this error I cant find out how to solve it.
Assets\scripts\movement.cs(38,25): error CS0019: Operator ‘*’ cannot be applied to operands of type ‘method group’ and ‘float’
getting this error I cant find out how to solve it.
Assets\scripts\movement.cs(38,25): error CS0019: Operator ‘*’ cannot be applied to operands of type ‘method group’ and ‘float’
None of us can help at all with no video and no code.
Look more closely at the video to see what you did wrong then.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movement : MonoBehaviour
{
[Header(“movement”)]
public float MovementSpeed;
public Transform orientation;
public float HorizontalInput;
public float VerticalInput;
Vector3 moveDirecton;
Rigidbody rb;
void Start()
{
rb = GetComponent();
rb.freezeRotation = true;
}
void MyInput()
{
HorizontalInput = Input.GetAxisRaw("horizontal");
VerticalInput = Input.GetAxisRaw("vertical");
}
void FixedUpdate()
{
Moveplayer();
}
void Moveplayer()
{
//calculate movement direction
moveDirecton = orientation.forward * VerticalInput * orientation.right * HorizontalInput;
rb.AddForce(moveDirecton.normalized.Scale * MovementSpeed * 10f, ForceMode.Force);
}
void Update()
{
MyInput();
}
}
Like I said, look more closely at the tutorial you’re following. I’m pretty sure it didn’t tell you to write .Scale here:
rb.AddForce(moveDirecton.normalized.Scale * MovementSpeed * 10f, ForceMode.Force);
You’re also making other typing mistakes, such as “horizontal”
The tutorial did NOT tell you to type “horizontal” all in lowercase. Don’t guess the correct answer; go back and see what I mean.
You must have absolutely ZERO typing mistakes. Focus and set aside an adequate amount of time. Do not rush because it WILL NOT WORK.
Two steps to tutorials and / or example code:
If you go past anything that you don’t understand, then you’re just mimicking what you saw without actually learning, essentially wasting your own time. It’s only two steps. Don’t skip either step.