XNA Game Development Forums
2012/05/21 19:52:14 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Spaceship orientation problem  (Read 1620 times)
murga
Newbie
*
Offline Offline

Posts: 3


View Profile
« on: 2007/07/15 03:31:59 »

Hi all,

Because this is my first post i need to say that you guys doing wonderfull job here with this engine.
Second on to my problem:
I'm having diffculties with Spaceship orientation in 3D. I have implemented basic selection box (Selection box tutorial). Using right mouse button i need to move my spaceship to that destination. having ship position and using viewport.unproject how can i calculate facing vector and movement of my ship?

Thnx in advance.
Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #1 on: 2007/07/17 02:37:51 »

So you are drawing a 2D box on the screen and want to move a 3D object there.

First of all your 2D box does not have any depth so you will have to decide how far this will be (unless you want to move to an object in the box)
Now you have a depth (either chosen or taken from an object in the box) you need to get the vector to move to, a target vector, you can do this with the ray picking code using the center of the box as the mouse x,y and the depth selected above as the end point, the unproject of these will give you the 3D X and Y and use your depth value for the Z.

To rotate your ship to point at the target coord, use the LookAt method that mike put in is last Camera tutorial, then move your object to the target.

Not tried any of that, but it sounds like it might work Tongue
Logged
murga
Newbie
*
Offline Offline

Posts: 3


View Profile
« Reply #2 on: 2007/07/18 06:02:59 »

So you are drawing a 2D box on the screen and want to move a 3D object there.

First of all your 2D box does not have any depth so you will have to decide how far this will be (unless you want to move to an object in the box)
Now you have a depth (either chosen or taken from an object in the box) you need to get the vector to move to, a target vector, you can do this with the ray picking code using the center of the box as the mouse x,y and the depth selected above as the end point, the unproject of these will give you the 3D X and Y and use your depth value for the Z.

To rotate your ship to point at the target coord, use the LookAt method that mike put in is last Camera tutorial, then move your object to the target.

Not tried any of that, but it sounds like it might work Tongue

It's not exactly 2D box where 3D object have to move, but a point. That point is calculated using ray picking code with some depth value when user press right mouse button on certain location.
Anyway thank's for pointing out for that LookAt code i'll see what can i do.
Stay tuned Smiley

btw. sorry for my english
Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #3 on: 2007/07/18 07:00:15 »

Don't worry about it, I am English, it's my only language and I am still terrible with it!  Grin
Logged
Pages: [1]
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Got a problem with an .x file Hazy Mind XNA Engine bobbie_dache 8 2784 Last post 2007/01/16 12:26:30
by bobbie_dache
Default World Orientation Hazy Mind XNA Engine Kitrik 8 2207 Last post 2007/01/25 04:59:47
by ericc59
World (Mesh) orientation and cameras Hazy Mind XNA Engine letsrock 4 2000 Last post 2007/03/13 11:09:49
by Robin Sarac
Animations! But one problem... Hazy Mind XNA Engine EclipsE 2 1415 Last post 2007/04/12 02:42:27
by EclipsE
tutorial 4 problem Hazy Mind 3D Engine precious roy 3 2499 Last post 2007/08/03 12:24:26
by mikeschuld
Interface problem. Help!! General Discussion XNASorcerer 5 2112 Last post 2007/05/09 09:46:36
by CarlosFreitas
ObjectManagers problem Hazy Mind XNA Engine Jonotron 1 1341 Last post 2007/08/03 12:29:19
by mikeschuld
Terrain orientation Hazy Mind XNA Engine Theoderich 1 1376 Last post 2007/07/30 00:20:17
by murga
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.381 seconds with 19 queries.