I’m trying to make a script that will lerp a variable titled “xOffset” n a script called “MouseOrbitOTS” from 0.75 to -0.75 when the input “Switch Shoulders” is tapped. Here’s the script I was working on…
using UnityEngine;
using System.Collections;
public class SwithShoulders : MonoBehaviour {
{
private Vector3 newPosition;
void Awake ()
{
newPosition = MouseOrbitOTS.xOffset
}
void Update ()
{
PositionCanging();
}
void PositionCanging();
{
Vector3 position1 = (0.75);
Vector3 position2 = (-0.75)
if (Input.GetButtonDown("Switch Shoulders")
if(newPosition = position1)
newPosition = position2
if (Input.GetButtonDown("Switch Shoulders")
if(newPosition = position2)
newPosition = position1
MouseOrbitOTS.xOffset = Vector3.Lerp(MouseOrbitOTS.xOffset, newPosition, Time.deltaTime);
}
}
The problem is, I’m very new to CSharp, and I got these errors which I don’t know how to fix…
Assets/SwithShoulders.cs(5,1): error CS1519: Unexpected symbol {' in class, struct, or interface member declaration Assets/SwithShoulders.cs(11,9): error CS1525: Unexpected symbol }‘, expecting ;' Assets/SwithShoulders.cs(19,9): error CS1519: Unexpected symbol {’ in class, struct, or interface member declaration
Assets/SwithShoulders.cs(23,18): error CS1519: Unexpected symbol if' in class, struct, or interface member declaration Assets/SwithShoulders.cs(23,40): error CS1519: Unexpected symbol (’ in class, struct, or interface member declaration
Assets/SwithShoulders.cs(24,36): error CS1519: Unexpected symbol =' in class, struct, or interface member declaration Assets/SwithShoulders.cs(24,47): error CS1519: Unexpected symbol )’ in class, struct, or interface member declaration
Assets/SwithShoulders.cs(25,38): error CS1519: Unexpected symbol =' in class, struct, or interface member declaration Assets/SwithShoulders.cs(27,18): error CS1519: Unexpected symbol if’ in class, struct, or interface member declaration
Assets/SwithShoulders.cs(27,40): error CS1519: Unexpected symbol (' in class, struct, or interface member declaration Assets/SwithShoulders.cs(28,40): error CS1519: Unexpected symbol =’ in class, struct, or interface member declaration
Assets/SwithShoulders.cs(28,51): error CS1519: Unexpected symbol )' in class, struct, or interface member declaration Assets/SwithShoulders.cs(29,38): error CS1519: Unexpected symbol =’ in class, struct, or interface member declaration
Assets/SwithShoulders.cs(33,1): error CS8025: Parsing error
If it helps, this is the video I tried to use to learn how to do this…
Thanks!