I am new and don't know how to fix this code

using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Security.Cryptography;
using System.Threading;
using UnityEngine;

public class SwingingArm : MonoBehaviour
{
    //GameObjects
    public GameObject LeftHand;
    public GameObject RightHand;
    public GameObject CenterEyeCamera;
    public GameObject ForwardDirection;

    //Vector3 positions
    private Vector3 PositionsPreviousFrameLeftHand;
    private Vector3 PositionPreviousFrameRightHand;
    private Vector3 PlayerPositionThisFrame;
    private Vector3 PlayerPositionPreviousFrame;
    private Vector3 PositionThisFrameLeftHand;
    private Vector3 PositionThisFrameRightHand;

    //Speed
    public float Speed - 70;
    private float HandSpeed;

    // Start is called before the first frame update
    void Start()
    {
        //Set original Previous frame positions at start up
        PlayerPositionPreviousFrame - transform.position;
        PositionsPreviousFrameLeftHand - LeftHand.transform.position;
        PositionPreviousFrameRightHand - RightHand.transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        //Get the forward direction from the center eye camera and set it to the forward direction object
        float yRotation -CenterEyeCamera.transform.eulerAngles.y;
        ForwardDirection.transform.eulerAngles - new Vector3(0, yRotation, 0);

        //Get current positions of hands
        PositionThisFrameLeftHand - LeftHand.transform.position;
        PositionThisFrameRightHand - RightHand.transform.position;
        //position off Player
        PlayerPositionThisFrame - transform.position;

        //Get distance the hands and player has moved since last frame
        var playerDistanceMoved -Vector3.Distance(PlayerPositionThisFrame, PlayerPositionPreviousFrame);
        var leftHandDistanceMoved -Vector3.Distance(PositionsPreviousFrameLeftHand, PositionThisFrameLeftHand);
        var rightHandDistanceMoved -Vector3.distance(PositionPreviousFrameRightHand, PositionThisFrameRightHand);

        //Add them up to get the handspeed from the user minus the movement of the player to neglect the movement of the player from The equation
        HandSpeed - ((leftHandDistanceMoved - playerDistanceMoved) + (rightHandDistanceMoved - playerDistanceMoved));


        if (Time.timeSinceLevelLoad > 1f)
            transform.position + -ForwardDirection.transform.forward * Speed * Timeout.deltaTime;



        //Set previous positions of hands for the next frame
        PositionThisFrameLeftHand - PositionThisFrameRightHand;
        //Set player position previous frame
        PlayerPositionPreviousFrame - PlayerPositionThisFrame;


    }
}

Help would be largely appreciated. error codes are

Assets\SwingingArm.cs(25,24): error CS1003: Syntax error, ‘,’ expected
Assets\SwingingArm.cs(41,25): error CS1002: ; expected
Assets\SwingingArm.cs(51,33): error CS1002: ; expected
Assets\SwingingArm.cs(52,35): error CS1002: ; expected
Assets\SwingingArm.cs(53,36): error CS1002: ; expected

Thanks in advanced

You seem to be using a minus sign - instead of an = sign on all of those lines.

Probably the same problem on line 56 and others.

ok i’ll go through it thanks

haha the tutorial is so low quality that the top line on the = is missing cause of compression lol

Having more trouble… error code
Assets\SwingingArm.cs(60,34): error CS1525: Invalid expression term ‘=’

using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Security.Cryptography;
using System.Threading;
using UnityEngine;

public class SwingingArm : MonoBehaviour
{
    //GameObjects
    public GameObject LeftHand;
    public GameObject RightHand;
    public GameObject CenterEyeCamera;
    public GameObject ForwardDirection;

    //Vector3 positions
    private Vector3 PositionsPreviousFrameLeftHand;
    private Vector3 PositionPreviousFrameRightHand;
    private Vector3 PlayerPositionThisFrame;
    private Vector3 PlayerPositionPreviousFrame;
    private Vector3 PositionThisFrameLeftHand;
    private Vector3 PositionThisFrameRightHand;

    //Speed
    public float Speed = 70;
    private float HandSpeed;

    // Start is called before the first frame update
    void Start()
    {
        //Set original Previous frame positions at start up
        PlayerPositionPreviousFrame = transform.position;
        PositionPreviousFrameLeftHand = LeftHand.transform.position;
        PositionPreviousFrameRightHand = RightHand.transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        //Get the forward direction from the center eye camera and set it to the forward direction object
        float yRotation = CenterEyeCamera.transform.eulerAngles.y;
        ForwardDirection.transform.eulerAngles = new Vector3(0, yRotation, 0);

        //Get current positions of hands
        PositionThisFrameLeftHand = LeftHand.transform.position;
        PositionThisFrameRightHand = RightHand.transform.position;
        //position off Player
        PlayerPositionThisFrame = transform.position;

        //Get distance the hands and player has moved since last frame
        var playerDistanceMoved = Vector3.Distance(PlayerPositionThisFrame, PlayerPositionPreviousFrame);
        var leftHandDistanceMoved = Vector3.Distance(PositionsPreviousFrameLeftHand, PositionThisFrameLeftHand);
        var rightHandDistanceMoved = Vector3.distance(PositionPreviousFrameRightHand, PositionThisFrameRightHand);

        //Add them up to get the handspeed from the user minus the movement of the player to neglect the movement of the player from The equation
        HandSpeed - ((leftHandDistanceMoved - playerDistanceMoved) + (rightHandDistanceMoved - playerDistanceMoved));


        if (Time.timeSinceLevelLoad > 1f)
            transform.position + = ForwardDirection.transform.forward * Speed * Time.deltaTime;



        //Set previous positions of hands for the next frame
        PositionsPreviousFrameLeftHand = PositionThisFrameLeftHand;
        PositionPreviousFrameRightHand = PositionThisFrameRightHand;
        //Set player position previous frame
        PlayerPositionPreviousFrame - PlayerPositionThisFrame;


    }
}

+= is a single operator, so it can’t have a space between the two. (Basically this means, “add (stuff to the right) to transform.position”)

1 Like