Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Simple rotation use case  (Read 2574 times)
0 Members and 1 Guest are viewing this topic.
Offline gregorypierce

Senior Member




I come upon thee like the blue screen of death....


« Posted 2005-01-24 16:17:40 »

Is there a mechanism that does simple Rotation behaviors like Java3D? If on each frame I want an object to rotate on its Y axis by a specified amount, how do I do that? SpatialTransformer, suggested in another thread, seems more complicated than I would think necessary for a replacement to RotationBehavior.

I'm looking at SpatialTransformer and I have some basic questions about why it works the way it does. If I have geometry attached to a node, I would want to attach a SpatialTransformer to it. Not sure why I have to tell it the number of objects it would be transforming - it would be all of the nodes that are the children of the node that the Transformer is attached to.

Root Node
|_ Transformer
|_ Node
        |_ Planet
        |_ Node
              |_ Moon

By Attaching the transformer to the 'root node' I expect I should be transforming everything underneath.

Similarly, why would I be attaching objects to the transformer? setObject just seems awkward in this sense. I have to attach the transformer to the rootNode (which IS my pivot point) and then attach all of its children to the Transformer as well?

The other sets (position, rotation, scale) make sense to me. But I should be able to set a rotation based off a Vector3f as well (0,1,0) -> rotate along the y axis.

I guess what I'm saying here is that this use case is very complex when it really should be obvious and simple but in this case appears to be neither and will be harder to learn.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline cep21

Junior Member




Java games rock!


« Reply #1 - Posted 2005-01-24 17:05:10 »

"Is there a mechanism that does simple Rotation behaviors like Java3D? If on each frame I want an object to rotate on its Y axis by a specified amount, how do I do that? SpatialTransformer, suggested in another thread, seems more complicated than I would think necessary for a replacement to RotationBehavior."

SpatialTransformer is more complicated because it does more than RotationBehavior for Java3d.  You can use it for a simple rotation if you want.  If you want help, I can show you how to make a basic rotation behavior Controller from scratch.

"I'm looking at SpatialTransformer and I have some basic questions about why it works the way it does. If I have geometry attached to a node, I would want to attach a SpatialTransformer to it. Not sure why I have to tell it the number of objects it would be transforming - it would be all of the nodes that are the children of the node that the Transformer is attached to."

Currently, Controllers and what they are attached to have no significance.  You could attach the controller to the root node and it would do the same thing if setup the same way.  Controllers are being removed for another animation system this release of jME.  Currently, there is no way to say "do this on all the children" without writting your own update function, which isn't very difficult in itself.  I can help with this if you want.  Controllers aren't objects in the scene graph.  They are a seperate property of the objects themselves.  This seems to be one point of confusion.

Root Node
|_ Transformer
|_ Node
   |_ Planet
   |_ Node
    |_ Moon

"By Attaching the transformer to the 'root node' I expect I should be transforming everything underneath."

The controller won't animate what it's not been specificly told to animate.  ControllerNode type behavior is planned for the next jME release.  I agree this system isn't best and that's why it will be gone on the next release.

"Similarly, why would I be attaching objects to the transformer? setObject just seems awkward in this sense. I have to attach the transformer to the rootNode (which IS my pivot point) and then attach all of its children to the Transformer as well?"

setObject is the way you tell the Controller what you want to animate.  The current way is to

1) Tell the controller everything you want to animate and how.
2) add things to your scene graph.
3) Attach controller to the scene graph.

"The other sets (position, rotation, scale) make sense to me. But I should be able to set a rotation based off a Vector3f as well (0,1,0) -> rotate along the y axis."

To do that you would have to create a Quat that represents that rotation.  There should be some functions that can do that for you in jME.  If not, I can post the math required.

"I guess what I'm saying here is that this use case is very complex when it really should be obvious and simple but in this case appears to be neither and will be harder to learn."

Modeling a solar system with sun->earth->moon is more complex than it seems at first.  You can't just attach them as children and rotate the moon around the earth because the earth is actually doing two rotations: rotating around the sun (year) and rotating around its core (days).  So if you rotate the earth to represent days and the moon is a child you end up with the moon rotating around the earth really fast.  You have to setup a center of rotation type system with a center of mass that the earth and moon can rotate around.  I've actually coded this exact thing before and posted the code on the jME forum.  I'll check my home computer and see if I still have it.
Offline gregorypierce

Senior Member




I come upon thee like the blue screen of death....


« Reply #2 - Posted 2005-01-24 17:53:25 »

Quote
"Is there a mechanism that does simple Rotation behaviors like Java3D? If on each frame I want an object to rotate on its Y axis by a specified amount, how do I do that? SpatialTransformer, suggested in another thread, seems more complicated than I would think necessary for a replacement to RotationBehavior."

SpatialTransformer is more complicated because it does more than RotationBehavior for Java3d.  You can use it for a simple rotation if you want.  If you want help, I can show you how to make a basic rotation behavior Controller from scratch.


I would be interested in seeing how this is done in jme.


Quote

Currently, Controllers and what they are attached to have no significance.  You could attach the controller to the root node and it would do the same thing if setup the same way.  Controllers are being removed for another animation system this release of jME.  Currently, there is no way to say "do this on all the children" without writting your own update function, which isn't very difficult in itself.  I can help with this if you want.  Controllers aren't objects in the scene graph.  They are a seperate property of the objects themselves.  This seems to be one point of confusion.


Interesting because I just expected them to be scene graph objects so I'll be greatly interested when they change. Is this in CVS now? If so I'll do a cvs update and play around with that Smiley

Quote

"By Attaching the transformer to the 'root node' I expect I should be transforming everything underneath."

The controller won't animate what it's not been specificly told to animate.  ControllerNode type behavior is planned for the next jME release.  I agree this system isn't best and that's why it will be gone on the next release.


Now you're just teasing me Smiley Whats the estimated time for the next release?



Quote

Modeling a solar system with sun->earth->moon is more complex than it seems at first.  You can't just attach them as children and rotate the moon around the earth because the earth is actually doing two rotations: rotating around the sun (year) and rotating around its core (days).  So if you rotate the earth to represent days and the moon is a child you end up with the moon rotating around the earth really fast.  You have to setup a center of rotation type system with a center of mass that the earth and moon can rotate around.  I've actually coded this exact thing before and posted the code on the jME forum.  I'll check my home computer and see if I still have it.


Cool. Would be interested in chatting with you as well. if you're open to some chatting, please PM communication options or just contact me. I think mine are public.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cep21

Junior Member




Java games rock!


« Reply #3 - Posted 2005-01-24 18:00:53 »

I won't be home till 11PMish CST so I'll look for the code then, and try to send you some PMs.  The new behavior code isn't in CVS yet, so no luck there.  The new release doesn't have a definitive date, but I'm guessing ... 1-2 months???
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (26 views)
2014-07-24 01:59:36

Riven (25 views)
2014-07-23 21:16:32

Riven (20 views)
2014-07-23 21:07:15

Riven (22 views)
2014-07-23 20:56:16

ctomni231 (51 views)
2014-07-18 06:55:21

Zero Volt (46 views)
2014-07-17 23:47:54

danieldean (37 views)
2014-07-17 23:41:23

MustardPeter (40 views)
2014-07-16 23:30:00

Cero (56 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!