iTwin.js
Published in

iTwin.js

Josh finds a way 🧭

“Dad, I want to learn pre-algebra. ” chirped 10-year-old Hannah. She was the smartest of the lot. Josh looked away from his computer screen and studied the curiosity in her eyes.

His first thought — “Why would anyone wanna learn pre-algebra?”

Followed by — “What the heck even is pre-algebra? Pre? Algebra?”

So he did what any person sitting in front of a computer would.

And what he saw next…defined the beginning of the iTwin.js sandbox.

Years passed.

The sandbox was now a reality. And Josh — whose daughter was the reason for its existence — was about to get his first opportunity to use it.

He was sitting in a meeting with — let’s call them…XYZ company.

One of the biggest IT firms in India.

They were looking for a way to automatically walk around their 3D models, and give their users a virtual tour of sorts. Think first-person video games — such as Minecraft or Call of Duty.

Thankfully — there was a sample out there that demonstrated this functionality:

“This is exactly what we need!” announced one of the engineers of the firm, as Josh presented this sample.

“But one question…how do we create our own paths?” he added reasonably.

That was an excellent question.

The sample only contained preprogrammed paths — if they copied the code directly…they would fly off into the middle of nowhere. There was no guidance on how to create your own custom path.

“Well that should be easy,” responded Josh, “it takes in a list of camera positions. You just need to pass in yours to create a new path.”

“And how do we create this list?” asked the XYZ engineer.

“Hmm, let me think. I bet you could write a simple tool…” Josh stopped talking mid-sentence.

Silence fell onto the meeting.

The words “write a simple tool” echoed through the chambers of his mind.

“Wait a second! The sandbox is finally real…I can write the tool for you!”

For those of you who haven’t guessed yet — Josh is the manager. And the sandbox has long been his dream project.

Ever since that innocent Google search instigated by Hannah. It led him to a website called “Khan Academy” where he discovered a JavaScript course that was studded with sandboxes.

To Josh, this was the perfect way of sharing code…an embedded editable, development environment that displays the output right next to the source!

Ever since then, it became his mission to bring this into the iTwin.js world. Every meeting that went by — in which a client would request sample code — he would get pangs of longing for the iTwin.js sandbox. Meeting after meeting, request after request — the lack of sandbox was driving him crazy.

Until the meeting with:

They needed to define a custom camera path.

“How do we create our own path?” asked the XYZ engineer.

And Josh realized:

“The sandbox is finally real!” Possessed with maniacal joy, he finally set out to do what he had been dreaming for years.

He rushed over to the iTwin.js Sandbox page, clicked on the “Create new sandbox” button, and wrote some shareable code. After an afternoon of productive coding, he ended up with the following sandbox.

It’s a nifty little tool that reveals the exact camera coordinates of a given position. The user can literally walk through their models to generate a path list.

When the XYZ engineers got their hands on this sandbox…they became experts at creating their own paths.

The beauty of this approach is that even though Josh wrote this sample once — anyone can access it, clone it, and extend it. The sandbox is the perfect mechanism for crystallizing sample code. Now — meeting after meeting, when clients request code — it doesn't go to waste. The sandbox playground acts as a fishing net that collects all these samples.

And the best part — each piece of sample code caught as a sandbox becomes highly discoverable. You can add #search #tags to help people find it on the iTwin.js website. All the public needs is a simple click of the search bar.

Speaking of search bars…Josh’s dream, and Hannah’s math career, have come a long way since the day of that original Google search (she is now excelling in trigonometry). Josh has high hopes for the future of both. With everything said and done though, there still remains one question to be answered.

Co-authored with Josh Schifter.

back

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store