Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (116)
games submitted by our members
Games in WIP (563)
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  
  Can Canvas3D rotate like Objects in TransformGroup  (Read 1527 times)
0 Members and 1 Guest are viewing this topic.
Offline AndyLau

Senior Newbie




Java games rock!


« Posted 2003-07-29 05:48:25 »

By Using MouseRotate , we can rotate objects in TransformGroup, but how can we make the Canvas3D rotate together? Thus if rotated, a circle drawn in the Canvas3D appear to be a oval to the man . will you please help me?
Online kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #1 - Posted 2003-07-29 06:41:39 »

The Canvas3D it self can't be rotated in the manner. I think what you want it to rotate the view. The view simple contains a TransformGroup and hence can be rotated in the same manner as everything else. Just look around at the classes View and ViewPlatform.

Kev

Offline AndyLau

Senior Newbie




Java games rock!


« Reply #2 - Posted 2003-07-29 07:02:55 »

If I rotate the view, it seems that Canvas3D and man's View both rotate, and the position between them is not changed. This is not what I want. I mean if there is a way to make the result that  Canvas3D rotate together with the objects in scene while the view dosen't rotate relatively.Then if rotated, a circle drawn in the Canvas3D appear to be a oval to the man
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #3 - Posted 2003-07-29 07:39:43 »

In that case, I don't think there is... what might possible be able to do something with AffineTransform(s) and the Graphics2D of Canvas3D.

Kev

Offline AndyLau

Senior Newbie




Java games rock!


« Reply #4 - Posted 2003-07-29 11:57:54 »

There is no way? Please help me to think out some method to rotate the Canvas3D.  Thanks!
Offline AndyLau

Senior Newbie




Java games rock!


« Reply #5 - Posted 2003-07-29 12:56:36 »

I do like this:

MouseRotate behavior=new MouseRotate();

u.getLocale().removeBranchGraph(u.getViewingPlatform());  // u --- SimpleIniverse

behavior.setTransformGroup(u.getViewingPlatform().getViewPlatformTransform());

behavior.setSchedulingBounds(bounds);

u.getViewingPlatform().addChild(behavior);

u.getLocale().addBranchGraph(u.getViewingPlatform());


By doing this , I can rotate the view. Then the object in TransformGroup rotate relatively.Because Canvas3D is associated with ViewPlatform, so Canvas3D rotate with the view? then to the view Canvas3D doesn't rotate unlike objects in TransformGroup. How can I solve this to make Canvas3D rotate relatively to view?
Offline Breakfast

Senior Member




for great justice!


« Reply #6 - Posted 2003-07-29 13:44:29 »

I'm a bit confused here, or possibly you are, I'm not sure. That's how confused I am.

The Canvas3D is the rectangular component in your application that displays the 3D view. This is equivalent to, for example, a television screen.

The View is the element of the 3D world that lets us see it - in the example this could be thought of as a camera plugged into the television screen.

What you seem to be asking is how you could keep the camera pointed one way and rotate the television, but I don't think that is what you mean. It is easiest to think of the view as your entry point into the world and not distinguish it from your Canvas3d.

Are you asking how to rotate an object in the scene and have the ViewPlatform rotate with the object?
Offline AndyLau

Senior Newbie




Java games rock!


« Reply #7 - Posted 2003-07-29 23:24:06 »

As you say:  Are you asking how to rotate an object in the scene and have the ViewPlatform rotate with the object?
If I do so, the object in the scene seems not to rotate because the WiewPlatform rotate together. Do you think so?

what I am asking is  how I could keep the View (camera)pointed one way and rotate the Canvas3D (television),or rotate the View while keeping the Canva3D stay.  Thus the object in the scene and Canvas3D seem to rotate together. Therefore, if I rotate the scene, then draw a circle on J3DGraphics2D of the Canvas3D,  it looks like an oval (In fact, it is a circle. ).  Like this:
J3DGraphics2D draw=c.getGraphics2D();  // c-- Canvas3D
draw.drawOval(10,10,50,50);
//  In fact a circle, but it looks like an oval if Canvas3D( or J3DGraphics2D) can be rotated.

I am anxious to know how I can do this. I need your help!  Thanks!!!
Offline Breakfast

Senior Member




for great justice!


« Reply #8 - Posted 2003-07-30 08:00:25 »

Right, I think I have worked it out now.

No. You can't rotate the actual Canvas in the application any more than you can rotate a JButton or any other user interface component.

It may be possible to create a custom Canvas3D component that only draws ever second vertical column to create the impression of having twisted the canvas itself, but that would be way outside my skills. I'm not sure if it's feasible in Java3D but certainly another way you might try is to offscreen render the scene to a texture on an on-screen object within a second scene that can then be rotated as you want.

Online kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #9 - Posted 2003-07-30 08:28:40 »

I'm still not really sure what you're trying to get to, but if you want to manipulate graphics contexts you can use:

Graphics.setTransform()

You may need to create a transform that fits what you want to do.

Kev

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.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (20 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

BurntPizza (32 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!