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

Raycast variable type in C#?

$
0
0
So i am trying to translate all my JS scripts to C# by using a converter and I understand that I will need to change a few errors that come up. In this most recent script, I am unsure of naming one of the variables I used in JS called "hit" Here is the code. I am having trouble because I don't think its supposed to be RaycastHit. JS function with hit. This is the only time hit is used function Update() { var hit : RaycastHit; var fwd = transform.TransformDirection(Vector3.forward); if(Physics.Raycast(transform.position, fwd, hit, rayLength)) { C# attempt. I assume RaycastHit is not a variable type or I named it incorrectly. void Update (){ RaycastHit hit; fwd = transform.TransformDirection(Vector3.forward); if(Physics.Raycast(transform.position, fwd, hit, rayLength)) {

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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