Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
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  
  tra\nslation and rotation problem  (Read 1191 times)
0 Members and 1 Guest are viewing this topic.
Offline hawkwind

Junior Devvie

Java games rock!

« Posted 2005-01-13 19:31:39 »


 I have an obj read in positioned say at 10,10,10.  When I rotate it around an axis it make a big loop around the actual scene axis instead of rotating arounds its own origin.  What the best way to make it rotate arounds it (local coordinates??)  Do I need to manually translate to 0,0,0, rotate, reposition back to 10,10,10 each time I rotate??
Offline William Denniss

JGO Coder

Projects: 2

Fire at will

« Reply #1 - Posted 2005-01-13 20:46:53 »

the age old question Smiley

It is important that your geometry is loaded with 0 as your reference point.  If your geometry is sitting at 10,10,10, then you are sunk (go back, correctly position the geometry and re-export the file).

The best way to achieve this is to have a chain of transform groups, like so:

Translate to (10,10,10) --> Rotate 90 degrees --> Object

That way, the object is rotated, then translated.

If you reverse the two TG's, then it is translated and then rotated.

If your geometry is at (10,10,10) when you exported, then trying to translate it (-10,-10,-10) won't actually work because that translation moves the relitive origin as well.  You have to manually translate the geometry vertex data array while loading (this is what I do with the ASE loader, fortunately the code is in the loader so it is now all automated).

I cover this in depth in the Transform Group Trees with the ASE loader tutorial in the GSG.  The advantage of the ASE loader is that I made it so that the tree is automatically built, and the geometry is offset by its pivot point and transformed into position.



Pages: [1]
  ignore  |  Print  

nelsongames (19 views)
2018-04-24 18:15:36

nelsongames (17 views)
2018-04-24 18:14:32

ivj94 (608 views)
2018-03-24 14:47:39

ivj94 (53 views)
2018-03-24 14:46:31

ivj94 (401 views)
2018-03-24 14:43:53

Solater (66 views)
2018-03-17 05:04:08

nelsongames (111 views)
2018-03-05 17:56:34

Gornova (176 views)
2018-03-02 22:15:33

buddyBro (747 views)
2018-02-28 16:59:18

buddyBro (94 views)
2018-02-28 16:45:17
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!