Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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  
  Local to Local transforms  (Read 1392 times)
0 Members and 1 Guest are viewing this topic.
Offline NewbTon

Junior Devvie




Odejava games rock!


« Posted 2004-12-06 11:22:55 »

Does anyone know how to get from one transform coordinate system to another ? Like, if you have a box in one transformgroup and move it to another, it shouldn't move in world space, but it's local coordinates will be altered. How do you perform that calculation ?
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2004-12-06 19:51:36 »

Thsi what youa re lookign for??
getLocalToVworld

public void getLocalToVworld(Transform3D t)

   Retrieves the local coordinates to virtual world coordinates transform for this node in the scene graph. This is the composite of all transforms in the scene graph from the root down to this node. It is only valid for nodes that are part of a live scene graph.

   Parameters:
       t - the object that will receive the local coordinates to Vworld coordinates transform.
   Throws:
       RestrictedAccessException - if the node is not part of a live scene graph
       CapabilityNotSetException - if appropriate capability is not set and this node is part of live scene graph
       IllegalSharingException - if the node is a descendant of a SharedGroup node.

Its a method available on any child of the Node superclass.

Docs are an amazing thing  Wink

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline NewbTon

Junior Devvie




Odejava games rock!


« Reply #2 - Posted 2004-12-06 20:41:52 »

Yes thanks to my knowledge I've read all known documentation to solve this but didn't find anything. I'm aware of the getLocalToVworld.  But it doesnt solve the problem.
My problem is :
A box changes parent, from transformgroup t1 to t2.  It shouldnt change it's posistion on screen (world coordinates) but it should change owner (from t1 to t2). If you change the owner without changing it's local coordinates it will most likely change it's position (on screen) in an unpredictable way, especially if both t1 and t2 are under a some sort of hierachy of nested transformgroups. So how do you do that ? I can't imagine this is not a very common problem in a scenegraph bases IPI. and there should be a simple solution to it.
A setLocalToVWorld() would take care of the problem though Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline phazer

Junior Devvie




Come get some


« Reply #3 - Posted 2004-12-07 05:50:44 »

You first need to get the world transform and then traverse down the down the branch where you want to place your box and multiply the transform with the inverse matrix of each transform group you encounter.

Offline NewbTon

Junior Devvie




Odejava games rock!


« Reply #4 - Posted 2004-12-07 09:00:12 »

Quote
You first need to get the world transform and then traverse down the down the branch where you want to place your box and multiply the transform with the inverse matrix of each transform group you encounter.

That sounds comlicated and expensive. But thanks going to give it a try.
Offline NewbTon

Junior Devvie




Odejava games rock!


« Reply #5 - Posted 2004-12-07 20:01:28 »

This did it  Roll Eyes
Transform3D worldTransform; //from transform
worldTransform.invert();
Vector3f v = new Vector3f();
localTransform.get(v); //to transform
worldTransform.transform(v);

//v has the right coordinates
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

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

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

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

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

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

Solater (140 views)
2018-03-17 05:04:08
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
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!