Hello,
How can I use function which have out arg in JS?
For example:
returnHello(string nickname, out hello)
Regards!
How to get "out arg" in JS?
Discussion in 'Hurtworld Development' started by SilentHillft, Mar 7, 2016.
-
This may help you:
How best to implement out params in JavaScript? -
LaserHydra,
I don't mean how to implement out argument to JS.
I mean how to read output argument from Raycast, actually my bad, but I don't know English so good -
Taken from the UnityEngine page:
Unity - Scripting API:
Code:function Update () { var fwd = transform.TransformDirection (Vector3.forward); if (Physics.Raycast (transform.position, fwd, 10)) { print ("There is something in front of the object!"); } }
-
Yeah, but I need to get hitInfo
-
-
-
[Solved]?
-
-
Code:function FixedUpdate () { // Push/turn the object based on arrow key input. rb.AddForce(Input.GetAxis("Vertical") * moveForce * transform.forward); rb.AddTorque(Input.GetAxis("Horizontal") * rotateTorque * Vector3.up);var hit: RaycastHit; var downRay = new Ray(transform.position, -Vector3.up);// Cast a ray straight downwards. if (Physics.Raycast(downRay, hit)) { // The "error" in height is the difference between the desired height // and the height measured by the raycast distance. var hoverError = hoverHeight - hit.distance;// Only apply a lifting force if the object is too low (ie, let // gravity pull it downward if it is too high). if (hoverError > 0) { // Subtract the damping from the lifting force and apply it to // the rigidbody. var upwardSpeed = rb.velocity.y; var lift = hoverError * hoverForce - upwardSpeed * hoverDamp; rb.AddForce(lift * Vector3.up); } } }
-
Code:
[Oxide] 21:47 [Error] Failed to load plugin xxx File: xxx.js Line: 1597 Column: 15 Unexpected token ::
Well, I'll make C# plugin as API, but it's not solved. -
That code was not supposed to be copy-pasted. It should just give you the solution to your question. -