[X3D-Public] jQuery plugin for working with x3dom scenes

Nathaniel Gibson nathaniel.gibson at gmail.com
Sat Jan 21 20:34:04 PST 2012

Hey everyone, I've been working on a plugin for jQuery which allows easy
and chained building of an x3dom scene.  I know that this is the x3d main
newsgroup, so I apologize if this might be a little off topic since it's
based on x3dom (a browser based standard for viewing x3d scenes)

 I have it up as a project on GitHub right now...  My basic goal is to make
it so that anyone can build an x3d scene almost like they build new X3DOM
elements and animate in jQuery.  I was really impressed with what I've seen
so far on the x3dom front, so I'm trying to make it more accessible for the
common web programmer (without having to learn rotation matrices, do a lot
of trigonometry, etc.)

Besides that, I am a web developer who doesn't really like to write so many
< and > tags, so for me it just makes sense and is way more efficient.
Here's some of the features I already have implemented (some are buggy

   - A 3D cursor (invisible) for each parent DOM object so that if you
   create children of that object, you can control where the offset is.
   - Quick and simple animations which add the "ROUTE" tags that are
   necessary for routing PositionInterpolator, RotationInterpolator and Scalar
   - Ability to send movements and rotations, etc. as an array of data
   - Rotation can be either expressed in [x, y, z, w] with radians (normal
   way), and likewise can be expressed in simply [x, y, z] using degrees (i.e:
   [180, 0, 0]) where javascript handles the conversion matrices, etc.
   - Full jQuery chainability for rapid development purposes.
   - A "container" transform which is just an empty transform (a very clean
   way to load parts of the scene using jQuery's "load" method [ajax])
   - Many other features: notes taken in the x3djq.js file for all the
   different functions

Here's some example code for instance of building a solar system using the
x3dom jQuery plugin.  It sets up all 9 planets, (yes, I classify pluto as a
planet [old habit],) then sets up viewpoints for each planet as well as
orbits for those planets.

//solar system setup

//Set up planets and sun's orbit containers and fill them with planets and
info, then start rotation
$('#sun_orbit').x3d('sphere','sun',{radius: 5});
$('#venus_orbit').x3d('setcursor',[6,0,0]).x3d('sphere','venus', {radius:
$('#earth_orbit').x3d('setcursor',[6.5,0,0]).x3d('sphere','earth', {radius:

//Set up planet group (planet, moons, views, text)
$('#mercury').x3d('setmaterial',{ texture: 'solarsys/Mercury.jpg'});


If you were to link x3djq.js in your document and put this script in as
well, you can see the example.  I've also put up a temporary working
example on my site at: http://webdombot.com/mediaSpydr/solarsystem.html ...
taking a look at the DOM through firebug, etc. you will find that creating
the scene through this plugin has reduced the number of characters I had to
type in my x3dom scene to about 15% of what it would be if I had to write
all of those html tags (3,000 some characters compared to 19,000+
characters).  Besides that, as a developer I wouldn't have to teach myself
all about routing, etc. concepts just to build animations.

There is a list of things yet to be done on the GitHub project so that
others can take a look at what's working and not.

I could really use some community support on this.  Anyone who knows jQuery
and is willing to pitch in please do.  Let's make x3dom a web standard and
get people building 3d websites!

The GitHub project is located at:

I'm working on the animation system and texturing at the moment.  My
overall goal is to have an animation object which allows for simple or
advanced position/scale/rotation animation, and there's a lot more to come.

I welcome anyone who's interested in joining the project.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20120122/40e3009e/attachment.html>

More information about the X3D-Public mailing list