Newbie - x3d (/VRML) and Java3d..... - vrml
This is a discussion on Newbie - x3d (/VRML) and Java3d..... - vrml ; Dear all,
I'm currently working on an x3d project in the world of academia; I have
experience with various other languages, but I'm a complete newbie with x3d.
Is it possible to build my x3d application on top of Java3d ...
-
Newbie - x3d (/VRML) and Java3d.....
Dear all,
I'm currently working on an x3d project in the world of academia; I have
experience with various other languages, but I'm a complete newbie with x3d.
Is it possible to build my x3d application on top of Java3d (/Java)??
To me, it seems sensible to build all my proto's as Java3d objects and
handle all my scripting within Java3d??
I suppose my question is "How do Java3d and x3d work together?"
(This question could just as easily be phrased - "How do Java and VRML fit
together?")
Any help would be much appreciated!
Regards,
Ben
-
Re: Newbie - x3d (/VRML) and Java3d..... - example....
Here's an example of what I've done so far......
I've created a (static) pool table - completely in x3d (I could have done
the same in VRML).
I now want to add interaction.
Firstly I would like to add collision detection[1]. This obviously requires
scripting... For which I will opt for Java[2]... This is where the issues
arise! In my current world everything is static (ie I have created a model),
in order to handle collisions my script must know where all the balls are
positioned. Hence it makes sense to handle the positioning of balls within
the script rather than the x3d code.....
Collision detection would be far easier if I had created the balls within
Java3d!!!
Hence, my question, is it possible to create my world using Java (or in my
case Java3d), using x3d for the front end only??
Hope that helps clarify my problem......
Cheers,
Ben
[1] I'll develop this as a small prototype, before implementing in my
virtual world
[2] Javascript is just as suitable, but I'm more familiar with Java. In
fact, I may actually use Java3d.
-
Re: Newbie - x3d (/VRML) and Java3d..... - example....
if you focus on thinking of vrml (x3d) as a world description format,
then there is a point where, if a lot of your 3d is based in java then
that is your description and you don't need vrml.
but i've done something like this in VRML, where each ball controls its
own motion, and then routes its position to a hub that then routes on
to all the other balls, each ball then can tell where/when its been hit
and can respond accordingly.
simon.
-
Re: Newbie - x3d (/VRML) and Java3d..... - example....
> but i've done something like this in VRML, where each ball controls its
> own motion, and then routes its position to a hub that then routes on
> to all the other balls, each ball then can tell where/when its been hit
> and can respond accordingly.
I think I have seen a similar example....
But it still seems more effort than writing in Java3d??
In Java3d I can define a BoundedSphere, I can then test for collisions (thus
enabling me to respond) using boundedSphere.intersect(boundedSphere2)....
On the other hand, if I were to define a Sphere in x3d (/VRML) I would need
to define my own intersect method....
This seems like far more work?
One potential problem I can see is - defining a PlaneSensor (for example) in
my world...
Ben
(Sorry if this doesn't make complete sense - I'm not too sure on how this
all works; yet...)
-
Re: Newbie - x3d (/VRML) and Java3d.....
> I suppose my question is "How do Java3d and x3d work together?"
You should take a look at Xj3D which is a VRML/X3D browser/library
written in java. Currently it can use java3D...
> (This question could just as easily be phrased - "How do Java and VRML fit
> together?")
.... but the authors are building now a OpenGL based version too...
VRML and java also fit together as a scripting language from "inside"
VRML (VRML script node) or a language to access VRML object from "outside"
(EAI)
so long
MUFTI
--
How to Remove Linux and Install Windows XP
NOTE: Windows XP and Linux can coexist on the same computer.
For additional information, refer to your Linux documentation.
Microsoft Knowledge Base Article - Q314458
-
Re: Newbie - x3d (/VRML) and Java3d..... - example....
ummm,
> In Java3d I can define a BoundedSphere, I can then test for
collisions (thus
> enabling me to respond) using
boundedSphere.intersect(boundedSphere2)....
i think with your project it might be save to go to a specific solution
for two spheres of the same diameter, in other words check to see if
the two balls are nearer than a ball diameter. ;-^
could even reduce it to the 2D plane of the table.
simon.
-
Re: Newbie - x3d (/VRML) and Java3d.....
Thanks for your suggestions so far....
Implementing the whole thing in Java3d seems like a possibility.....
however, I would then lose features such as PlaneSensor! And being academia,
I probably wouldn't get many marks.... seeing as my project is suppose to be
written in x3d! ;-)
My current line of thought.......
My scripting language must keep its own 'model' of the world in order to
manage it, this model can be created by any means (inc. Java3d for example).
In order to keep my script and VR world seperate, my script must be
dynamic......
By dynamic I mean: if the VR world were to change (ball sizes to increase,
for example), the script should not need to be altered. This is a reasonable
objective.... but it adds complexity to the script.
How do I go about accessing this kind of information from a script???
Simple VRML example:
#VRML V2.0 utf8
DEF myShape Transform{
translation 1 1 1
children[
Shape{
geometry Sphere{
radius 2
}
}
DEF myScript Script{
field SFNode thisShape USE myShape
url "javascript:
function initialize() {
print(thisShape.translation); //SUCCESS
print(thisShape.children.Shape.Sphere.radius); //FAILS
}
"
}
]
}
How can I successfully get thisShape.children.Shape.Sphere.radius??
Cheers,
Ben
-
Re: Newbie - x3d (/VRML) and Java3d.....
> }
> }
>
> DEF myScript Script{
> field SFNode thisShape USE myShape
> url "javascript:
> function initialize() {
> print(thisShape.translation); //SUCCESS
> print(thisShape.children.Shape.Sphere.radius); //FAILS
> }
> "
> }
> ]
> }
>
> How can I successfully get thisShape.children.Shape.Sphere.radius??
Try:
thisShape.children[0].geometry.radius
bye
md
-
Re: Newbie - x3d (/VRML) and Java3d.....
> Try:
>
> thisShape.children[0].geometry.radius
Works a treat!!
Many thanks.
Regards,
Ben
-
Re: Newbie - x3d (/VRML) and Java3d.....
> Try:
>
> thisShape.children[0].geometry.radius
I don't suppose you know the X3D conversion??
CODE:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"
"http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile="Immersive">
<Scene>
<Transform translation="1 1 1">
<Shape>
<Sphere radius="2"/>
</Shape>
<Script>
<field name="thisShape" type="SFNode" accessType="initializeOnly"
USE="myShape"/>
<![CDATA[
ecmascript:
function initialize() {
Browser.print(thisShape.translation); //FAILS
Browser.print(thisShape.children[0].geometry.radius); //FAILS
}
]]>
</Script>
</Transform>
</Scene>
</X3D>
Thanks for your time.
Regards,
Ben
Similar Threads
-
By Application Development in forum vrml
Replies: 0
Last Post: 11-03-2003, 04:48 PM
-
By Application Development in forum vrml
Replies: 3
Last Post: 10-07-2003, 03:30 PM
-
By Application Development in forum vrml
Replies: 0
Last Post: 09-16-2003, 09:39 AM
-
By Application Development in forum vrml
Replies: 1
Last Post: 09-10-2003, 06:01 PM