- Home /
Other
C# extension translation to JS?
Hello Everyone,
So I've been following a rather good tutorial from Pixelnest studios about the new 2D framework in Unity. I've gotten to the part where I'm implementing parallax scrolling. The tutorial is written in C# but I'm only familiar with Javascript so I've been able to rewrite their tutorial as we go. Except at this point. The tutorial talks about programming a C# Renderer Extension script. Here's the script:
using UnityEngine;
public static class RendererExtensions
{
public static bool IsVisibleFrom(this Renderer renderer, Camera camera)
{
Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera);
return GeometryUtility.TestPlanesAABB(planes, renderer.bounds);
}
}
My question is simply, is this script something that can be translated into JS? Or because it's a C# extension, does it have to remain in C# or what?
Thanks ahead of time for your help! -Kaze-
Answer by Damien Mayance · Feb 24, 2014 at 12:27 AM
Hello, (I'm the tutorial co-writer)
This script comes from the Unity wiki, and has a JavaScript version: http://wiki.unity3d.com/index.php?title=IsVisibleFrom
I guess the usage is slightly different but the result should be the same.
I hope that helps.
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Script generation. 1 Answer
Moving object top to down 2 Answers