[HELP!]how do i make a sphere rotate around a center position?

This is probably a very newbie question, but ive been stuck on this for a while now.



i want to make a sphere rotate around a center. a circular motion in other words.



i tried to use setLocaltranslation on the x and z coordinates every update cycle. but it just doesnt work…



thx!

the problem occured again for some reason.



i change some code into a new class so i can add in more attributes.



is there a utility class that actually can do this animation?

just to mak things a little bit more clear.



what im trying to do is make an object revovle around a center position. like the moon goes around the center of the earth.



thx~~~

You could use the scenegraph to Your advantage to do this.

Just attach the sphere to a node then set the spheres local translation to the radius You want, then set the local rotation of the node each update cycle

(from inside a controller)

Use the SpatialTransform class and set the rotational attributes about the centre of the earth.

winkman said:

You could use the scenegraph to Your advantage to do this.
Just attach the sphere to a node then set the spheres local translation to the radius You want, then set the local rotation of the node each update cycle
(from inside a controller)


i have 3 moons and im planning to add in more, and they each has a different radius, so i cant combine them into one node.

and the controller part is what i dont know how to implement. help~

thx
adamgp said:

Use the SpatialTransform class and set the rotational attributes about the centre of the earth.


how do i set the rotational attributes about the center? i only know how to set it about an axis, leanred from the tutorial.

help~ thx
Quote:
i have 3 moons and im planning to add in more, and they each has a different radius, so i cant combine them into one node.

Using winkman's solution you'll need to create one node per moon then attach all these nodes to your center point object (or node). Your scenegraph should look like this:

thx Mr.Marbles.



i just tried it out, and it works fine.



sry for all these newbie questions. still learning ha~ :smiley:



thx for all the help guys~ u guys r the best

Perfect explanation and presentation Mr. Marbles  ;)  thanks

@mr.marbles: nice diagram.  Helpfull posts like that are just what I was talking about when I touted our forums in the JavaOne presentation.

Yep, very nice, it's now part of the wiki :wink:



http://www.jmonkeyengine.com/wiki/doku.php?id=rotate_about_a_point

the diagram is gone (in the wiki too): the link to the image doesn't work here

It was up merely an hour ago… where did it go?  :?

Thought the wiki would cache it. I'll just remake it. ('twas simple but effective)

glad i brought something useful up for the community  :lol:



even though i didnt contribute wahaha!!! }:-@

Quote:
the diagram is gone (in the wiki too): the link to the image doesn't work here
I'm not sure why you have problems viewing the diagram, I see it just fine in my post. Maybe the photo hosting server was temporarily down. Seems fine now.
Quote:
Yep, very nice, it's now part of the wiki
Glad I could help  :D