Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Nov 09, 2014 at 06:34 PM by Graham-Dunnett for the following reason:

Duplicate Question - http://answers.unity3d.com/questions/topics/cs8025.html

avatar image
0
Question by KronoZ · Nov 09, 2014 at 06:33 PM · parsing errorcs8025

Parser Error

I am getting a error which is : PlayerCamer.cs (6,36): error cs8025 Parsing Error

Script:

using UnityEngine; using System.Collections;

using Helper;

public class ThirdPersonController ;

{

 void LateUpdate()

 #region Try


 viewFrustum = DebugDraw.CalculateViewFrustum(camera, ref nearClipDimensions);
 // Pull values from controller/keyboard
 float rightX = Input.GetAxis("RightStickX");
 float rightY = Input.GetAxis("RightStickY");
 float leftX = Input.GetAxis("Horizontal");
 float leftY = Input.GetAxis("Vertical");
 float mouseWheel = Input.GetAxis("Mouse ScrollWheel");
 float mouseWheelScaled = mouseWheel * mouseWheelSensitivity;
 float leftTrigger = Input.GetAxis("Target");
 bool bButtonPressed = Input.GetButton("ExitFPV");
 bool qKeyDown = Input.GetKey(KeyCode.Q);
 bool eKeyDown = Input.GetKey(KeyCode.E);
 bool lShiftKeyDown = Input.GetKey(KeyCode.LeftShift);
 // Abstraction to set right Y when using mouse
 if (mouseWheel != 0)
 {
     rightY = mouseWheelScaled;
 }
 if (qKeyDown)
 {
     rightX = 1;
 }
 if (eKeyDown)
 {
     rightX = -1;
 }
 if (lShiftKeyDown)
 {
     leftTrigger = 1;
 }
 characterOffset = followXform.position + (distanceUp * followXform.up);
 Vector3 lookAt = characterOffset;
 targetPosition = Vector3.zero;
 // Determine camera state
 // * Targeting *
 if (leftTrigger > TARGETING_THRESHOLD)
 {
     barEffect.coverage = Mathf.SmoothStep(barEffect.coverage, widescreen, targetingTime);
     camState = CamStates.Target;
 }
 else
 {
     barEffect.coverage = Mathf.SmoothStep(barEffect.coverage, 0f, targetingTime);
     // * First Person *
     if (rightY > firstPersonThreshold && camState != CamStates.Free && !follow.IsInLocomotion())
     {
         // Reset look before entering the first person mode
         xAxisRot = 0;
         lookWeight = 0f;
         camState = CamStates.FirstPerson;
     }
     // * Free *
     if ((rightY < freeThreshold || mouseWheel < 0f) && System.Math.Round(follow.Speed, 2) == 0)
     {
         camState = CamStates.Free;
         savedRigToGoal = Vector3.zero;
     }
     // * Behind the back *
     if ((camState == CamStates.FirstPerson && bButtonPressed) ||
         (camState == CamStates.Target && leftTrigger <= TARGETING_THRESHOLD))
     {
         camState = CamStates.Behind;
     }
 }
 // Set the Look At Weight - amount to use look at IK vs using the head's animation
 follow.Animator.SetLookAtWeight(lookWeight);
 // Execute camera state
 switch (camState)
 {
 case CamStates.Behind:
     ResetCamera();
     // Only update camera look direction if moving
     if (follow.Speed > follow.LocomotionThreshold && follow.IsInLocomotion() && !follow.IsInPivot())
     {
         lookDir = Vector3.Lerp(followXform.right * (leftX < 0 ? 1f : -1f), followXform.forward * (leftY < 0 ? -1f : 1f), Mathf.Abs(Vector3.Dot(this.transform.forward, followXform.forward)));
         Debug.DrawRay(this.transform.position, lookDir, Color.white);
         // Calculate direction from camera to player, kill Y, and normalize to give a valid direction with unit magnitude
         curLookDir = Vector3.Normalize(characterOffset - this.transform.position);
         curLookDir.y = 0;
         Debug.DrawRay(this.transform.position, curLookDir, Color.green);
         // Damping makes it so we don't update targetPosition while pivoting; camera shouldn't rotate around player
         curLookDir = Vector3.SmoothDamp(curLookDir, lookDir, ref velocityLookDir, lookDirDampTime);
     }
     targetPosition = characterOffset + followXform.up * distanceUp - Vector3.Normalize(curLookDir) * distanceAway;
     Debug.DrawLine(followXform.position, targetPosition, Color.magenta);
     break;
 case CamStates.Target:
     ResetCamera();
     lookDir = followXform.forward;
     curLookDir = followXform.forward;
     targetPosition = characterOffset + followXform.up * distanceUp - lookDir * distanceAway;
     break;
 case CamStates.FirstPerson:
     // Looking up and down
     // Calculate the amount of rotation and apply to the firstPersonCamPos GameObject
     xAxisRot += (leftY * 0.5f * firstPersonLookSpeed);
     xAxisRot = Mathf.Clamp(xAxisRot, firstPersonXAxisClamp.x, firstPersonXAxisClamp.y);
     firstPersonCamPos.XForm.localRotation = Quaternion.Euler(xAxisRot, 0, 0);
     // Superimpose firstPersonCamPos GameObject's rotation on camera
     Quaternion rotationShift = Quaternion.FromToRotation(this.transform.forward, firstPersonCamPos.XForm.forward);
     this.transform.rotation = rotationShift * this.transform.rotation;
     // Move character model's head
     follow.Animator.SetLookAtPosition(firstPersonCamPos.XForm.position + firstPersonCamPos.XForm.forward);
     lookWeight = Mathf.Lerp(lookWeight, 1.0f, Time.deltaTime * firstPersonLookSpeed);
     // Looking left and right
     // Similarly to how character is rotated while in locomotion, use Quaternion * to add rotation to character
     Vector3 rotationAmount = Vector3.Lerp(Vector3.zero, new Vector3(0f, fPSRotationDegreePerSecond * (leftX < 0f ? -1f : 1f), 0f), Mathf.Abs(leftX));
     Quaternion deltaRotation = Quaternion.Euler(rotationAmount * Time.deltaTime);
     follow.transform.rotation = (follow.transform.rotation * deltaRotation);
     // Move camera to firstPersonCamPos
     targetPosition = firstPersonCamPos.XForm.position;
     // Smoothly transition look direction towards firstPersonCamPos when entering first person mode
     lookAt = Vector3.Lerp(targetPosition + followXform.forward, this.transform.position + this.transform.forward, camSmoothDampTime * Time.deltaTime);
     Debug.DrawRay(Vector3.zero, lookAt, Color.black);
     Debug.DrawRay(Vector3.zero, targetPosition + followXform.forward, Color.white);
     Debug.DrawRay(Vector3.zero, firstPersonCamPos.XForm.position + firstPersonCamPos.XForm.forward, Color.cyan);
     // Choose lookAt target based on distance
     lookAt = (Vector3.Lerp(this.transform.position + this.transform.forward, lookAt, Vector3.Distance(this.transform.position, firstPersonCamPos.XForm.position)));
     break;
 case CamStates.Free:
     lookWeight = Mathf.Lerp(lookWeight, 0.0f, Time.deltaTime * firstPersonLookSpeed);
     Vector3 rigToGoal = characterOffset - cameraXform.position;
     rigToGoal.y = 0f;
     Debug.DrawRay(cameraXform.transform.position, rigToGoal, Color.red);
     // Panning in and out
     // If statement works for positive values; don't tween if stick not increasing in either direction; also don't tween if user is rotating
     // Checked against rightStickThreshold because very small values for rightY mess up the Lerp function
     if (rightY < lastStickMin && rightY < -1f * rightStickThreshold && rightY <= rightStickPrevFrame.y && Mathf.Abs(rightX) < rightStickThreshold)
     {
         // Zooming out
         distanceUpFree = Mathf.Lerp(distanceUp, distanceUp * distanceUpMultiplier, Mathf.Abs(rightY));
         distanceAwayFree = Mathf.Lerp(distanceAway, distanceAway * distanceAwayMultipler, Mathf.Abs(rightY));
         targetPosition = characterOffset + followXform.up * distanceUpFree - RigToGoalDirection * distanceAwayFree;
         lastStickMin = rightY;
     }
     else if (rightY > rightStickThreshold && rightY >= rightStickPrevFrame.y && Mathf.Abs(rightX) < rightStickThreshold)
     {
         // Zooming in
         // Subtract height of camera from height of player to find Y distance
         distanceUpFree = Mathf.Lerp(Mathf.Abs(transform.position.y - characterOffset.y), camMinDistFromChar.y, rightY);
         // Use magnitude function to find X distance
         distanceAwayFree = Mathf.Lerp(rigToGoal.magnitude, camMinDistFromChar.x, rightY);
         targetPosition = characterOffset + followXform.up * distanceUpFree - RigToGoalDirection * distanceAwayFree;
         lastStickMin = float.PositiveInfinity;
     }
     // Store direction only if right stick inactive
     if (rightX != 0 || rightY != 0)
     {
         savedRigToGoal = RigToGoalDirection;
     }
     // Rotating around character
     cameraXform.RotateAround(characterOffset, followXform.up, freeRotationDegreePerSecond * (Mathf.Abs(rightX) > rightStickThreshold ? rightX : 0f));
     // Still need to track camera behind player even if they aren't using the right stick; achieve this by saving distanceAwayFree every frame
     if (targetPosition == Vector3.zero)
     {
         targetPosition = characterOffset + followXform.up * distanceUpFree - savedRigToGoal * distanceAwayFree;
     }
     break;
 }



Comment
Comments Locked
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Unexpected Symbol 'end-of-file' C# Error CS8025 1 Answer

error CS8025: Parsing error 0 Answers

HElp fix this Assets/enemy/2.cs(1,12): error CS8025: Parsing error 0 Answers

CS8025 error 1 Answer

Parsing Error 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges