Hello,Can I use C# in babylon?if yes How?
And if not,I know TypeScript is the Solution,But can I use Babylon only with TypeScript(without knowing html and javaScript).This question means alot to me,Thanks in advance
Hi
@Hasnain_farid
You can use Babylon’s with TypeScript and you don’t need any js, but you need to setup html template or use existing one where your bundled typescript app will be loaded. Regarding c# no you can not use, at least not directly, could try to find some c#->js compiler though.
Thanks,but what what abt html and css,do i need to learn that?
css, probably not. Html is also going to be minimal, if all you want is the entire window to contain the webgl context.
<html>
<head>
<meta charset="UTF-8">
<title>Not required, but shows as tab text</title>
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<style>
html, body { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; }
#renderCanvas{ width: 100%; height: 100%; }
</style>
</head>
<body>
<canvas id="renderCanvas"></canvas>
<script>
const canvas = document.getElementById("renderCanvas");
const engine = new BABYLON.Engine(canvas, true);
let skeleton;
const scene = new BABYLON.Scene(engine);
const url = "./";
BABYLON.SceneLoader.Append(url, "armature.babylon", scene);
scene.executeWhenReady(function () {
skeleton = scene.getSkeletonByName("base_male1");
skeleton.beginAnimation("base08_11x94", true);
// Attach camera to canvas inputs
scene.activeCamera.attachControl(canvas);
// Once the scene is loaded, register a render loop
engine.runRenderLoop(function() {
scene.render();
});
});
//Resize
window.addEventListener("resize", function () {
engine.resize();
});
</script>
</body>
</html>
As far as C++, you may integrate it into something that can be called from JS, but not the other way around. It is involved though, so unless it is a performance bottle neck, best not to do. Of course, the only way to know if it is a bottle neck is to code it in JS first, then profile using a browser profiler, Chrome’s recommended.
It depends on your project, but in my opinion you can absolutely start without the other languages. It’s even possible to create the UI complety with Babylon…so just go for it!
If you need a simple Setup, then just use the “Download ZIP” function in the playground:
Guys You are awesome,God Bless Humanity