Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Problem with my code and CANT FIND THE MISTAKE!!!

$
0
0
So, I got the error message: "Assets/Scripts/PhysicsObject.cs(66,47): error CS1525: Unexpected symbol `)' " I looked through the code multiple times for the closing bracket but I can't find any misplaced ones. I also checked for other noting flaws but couldn't find any for as far as I know... Can someone help? Here's the full list (and yes, it's pretty much entirely copied from the 2D Platformer Character Controller tutorial but I'm a huge code-noob and still learning) using System.Collections; using System.Collections.Generic; using UnityEngine; public class PhysicsObject : MonoBehaviour { public float gravityModifier = 1f; public float minGroundNormalY = .65f; protected bool grounded; protected Vector2 groundNormal; protected Rigidbody2D rb2d; protected Vector2 velocity; protected ContactFilter2D contactFilter; protected RaycastHit2D[] hitBuffer = new RaycastHit2D[16]; protected ListhitBufferList = new List (16); protected const float minMoveDistance = 0.001f; protected const float shellRadius = 0.01f; void OnEnable() { rb2d = GetComponent (); } void Start () { contactFilter.useTriggers = false; contactFilter.SetLayerMask (Physics2D.GetLayerCollisionMask (gameObject.layer) ); contactFilter.useLayerMask = true; } void Update () { } void FixedUpdate () { velocity += gravityModifier * Physics2D.gravity * Time.deltaTime; grounded = false; Vector2 deltaPosition = velocity * Time.deltaTime; Vector2 move = Vector2.up * deltaPosition.y; Movement (move, true); } void Movement (Vector2 move, bool yMovement) { float distance = move.magnitude; if (distance > minMoveDistance) { int count = rb2d.Cast(move, contactFilter, hitBuffer, distance + shellRadius); hitBufferList.Clear (); for (int i = 0; i < count; i++) { hitBufferList.Add (hitBuffer [i]); } for (int i = 0; i < hitBufferList.count; i++) { Vector2 currentNormal = hitBufferList[i].normal; if (currentNormal.y > minGroundNormalY) { grounded = true; if (yMovement) { groundNormal = currentNormal; currentNormal.x = 0; } } float projection = Vector2.Dot (velocity, currentNormal); if (projection < 0) { velocity = velocity - projection * currentNormal; } float modifiedDistance = hitBufferList[i].distance - shellRadius; distance = modifiedDistance < distance ? modifiedDistance : distance; } } rb2d.position = rb2d.position + move.normalized * distance; } } I wrote it in Notepad++ with C# syntaxis and character set UTF-8-BOM Hope to hear from someone soon

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>