forked from AdamAtomic/flixel
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlxTilemap.ray() Result value always null #8
Milestone
Comments
Comment by: moly I don't think the error is with flixel here. This code: var result:FlxPoint = new FlxPoint();
tile.ray(startPoint, endPoint, result);
trace(result.x + " " + result.y); works fine for me. I think you were probably doing this: var result:FlxPoint;
tilemap.ray(startPoint, endPoint, result); which is essentially just passing null as the third parameter and will always give you null back. |
moly
added a commit
to moly/flixel
that referenced
this issue
Sep 16, 2012
… always null I believe this issue was caused by the user mistakenly passing in a null pointer. I've just updated the code slightly to make it more obvious how it works, and to remove an unnecessary FlxPoint creation.
Resolved by commit e5a7345 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue #224 by: cr0ybot
Supposedly AS3 passes all objects as reference, but this does not appear to be the case with the "Result" FlxPoint in FlxTilemap.ray(). Checking the Result value always results in null.
See this stackoverflow question for a very similar situation:
http://stackoverflow.com/questions/3708371/actionscript-pass-by-reference
Why is it necessary to do the raycast in this manner? Why return a boolean at all if you can just return the FlxPoint (if the ray hits anything) and check for null?
The text was updated successfully, but these errors were encountered: