Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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  
  Moving around a scene using cursor keys  (Read 1336 times)
0 Members and 1 Guest are viewing this topic.
Offline tomcat

Senior Newbie




Java games rock!


« Posted 2003-12-05 14:41:27 »

I have tried to create a rotation object and add that to the view in order to turn the view allowing me looking around and walking around the scene. However this doesnt work. Huh

Does anybody know how to add navigation to the scene using cursor keys and/or mouse?
tomcat
Offline Preston

Senior Devvie


Medals: 4



« Reply #1 - Posted 2003-12-05 16:34:10 »

Please have a look at the thread named "camera movement", aged a few days ago:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1070332396

I think it addresses the same problem you do experience. (Actually I experienced the same one, too, when I started with Xith3d some weeks ago. ;-)
Offline tomcat

Senior Newbie




Java games rock!


« Reply #2 - Posted 2003-12-06 08:23:03 »

Thanks Preston, I will try this.  When I move around using cursor keys, I have x,y,z values but no angles so I guess I can just pass 0. Is this right?

Another thing is that where do I attach the camera to. Do I add it to the locale or do I add it to the root BranchGroup? (to get a kind of first person view)
tomcat
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Preston

Senior Devvie


Medals: 4



« Reply #3 - Posted 2003-12-06 10:22:29 »

Quote
Thanks Preston, I will try this.  When I move around using cursor keys, I have x,y,z values but no angles so I guess I can just pass 0. Is this right?

Yes. And in case you prefer to handle radian angles (0 .. PI) and not angles degrees (0..360) you can skip that Math.toRadians() method call, too.

Quote
Another thing is that where do I attach the camera to. Do I add it to the locale or do I add it to the root BranchGroup? (to get a kind of first person view)
tomcat

Yes, exactly. For my previously quoted example I've just made something like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
  private View mView = new View();
  private BranchGroup mSceneBg = new BranchGroup();  // Root-Branchgroup

void initXith(Canvas3D kanvas3d)
{
  RenderPeer renderpeer = new RenderPeerImpl();
  CanvasPeer canvaspeer = renderpeer.makeCanvas(freim, 320, 200, Opt.sGuiVollbildBpp, false);
  kanvas3d.set3DPeer(canvaspeer);
  mView.addCanvas3D(kanvas3d);

  VirtualUniverse univers = new VirtualUniverse();
  Locale lokal = new Locale();
  univers.addLocale(lokal);
  univers.addView(mView);
  lokal.addBranchGraph(mSceneBg);
}
Offline tomcat

Senior Newbie




Java games rock!


« Reply #4 - Posted 2003-12-06 10:37:09 »

Great Smiley, thanks for this. I will try it with my example.
tomcat
Offline tomcat

Senior Newbie




Java games rock!


« Reply #5 - Posted 2003-12-08 21:21:20 »

having worked out (I think) how to do a first person shooter (thanx Preston) I have realised that I was after something slightly different. I have a car and I want to see my car (all of it not just through the windscreen). I think this is called 2nd or 3rd person perspective (not sure about the name).

I thought a way of doing this is  by placing the camera several units behind the car and have it following the car. Any suggestions as what is the best way of doing this?

tomcat
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.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (64 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!