Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

GetComponent() problems

$
0
0
So I am trying to get the size of my Collider, but it keeps giving me errors. #pragma strict static var CldHeadD : int[]; static var CldLeftD : int[]; static var CldRightD : int[]; static var CldFeetD : int[]; static var CldcornersD : int[]; static var Skin : float = 0.9; static var Size : Vector2; static var tp : Vector3; function Start () { CldHeadD = new int[4]; CldLeftD = new int[4]; CldRightD = new int[4]; CldFeetD = new int[4]; CldcornersD = new int[4]; } function FixedUpdate () { tp = transform.position; Size = this.GetComponent().size; for (var XU : int = 0; XU <= CldHeadD.length; XU++){ /*aray length*/ var HitUp = Physics2D.Raycast(Vector2(/*pos.x*/tp.x + (XU - (Size.x * 0.5)) * Skin/*pos.x*/, /*pos.y*/ tp.y + (Size.y * 0.5) * Skin/*pos.y*/), Vector2.up); CldHeadD[XU] = HitUp.distance;/*Set distance*/ print(CldHeadD); } } and I get these errors. Assets/Jorge/Scripts/Player/NEW/Colliding2.js(22,49): BCE0043: Unexpected token: ). Assets/Jorge/Scripts/Player/NEW/Colliding2.js(22,50): BCE0044: expecting ), found '.'. Assets/Jorge/Scripts/Player/NEW/Colliding2.js(22,51): UCE0001: ';' expected. Insert a semicolon at the end.

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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