Jump to content

  • Log In with Google      Sign In   
  • Create Account

FromShadow

Member Since 07 Nov 2012
Offline Last Active Jan 08 2013 06:05 PM

#5016918 Need help getting a child object to orbit a parent object ...

Posted by FromShadow on 02 January 2013 - 06:44 PM

What you have to do is transform the difference vector between parent and child, not the child position itself.

Rotations matrices always rotate about the origin, so the easiest thing is to (temporarily) change your coordinate system so the parent ship's position is the origin:

 

 

Vector2 d = childShipPositionPoint - parentShipPositionPoint;
d = Vector2.Transform(d, Matrix.CreateRotationZ(15));
childShipPositionPoint = parentShipPositionPoint + d;

 

Let me know if this is what you are looking for.




#5014231 Space game graphics with Depth perception

Posted by FromShadow on 25 December 2012 - 02:54 PM

Thanks for the answers. I see now that fog really was the wrong approach.
I have worked on the suggestions and thought I'd share the results:
  • I had a hard time drawing a Skybox myself, mostly due to parallax errors in the corners and my inability to mask the transitions at the edges. For anyone searching, try Spacespace (http://alexcpeterson.com/spacescape). It does the job beatifully and I'm glad I stumbled on this. For the time being, I could get away with a single rendering pass, since there are no distant objects and the skybox is 10000 big, as suggested.

  • The Skybox helped with orientation in a relative manner, like you can tell which way you are turning/looking. But what I needed was an absolute reference point, so I followed Prinz Eugn's advice and added a milky way band all arround one axis (It's actually tilted, but there is no way to notice, which I'm pretty happy about). The galaxy is additively blended over the background which works great.

  • The galactic core on the side of the sky box further helps with orientation. I made it really bright and added directional lighting. sharp lighting really is the way to go, I more than doubled the intensity and it looks good. smile.png

  • HUD: For now I added a line for each ship to indicate its current target. There is a lot to be done, like showing the estimated flight path (which should be curved rather than straight). Right now it is a wirefrime line, but I would want it to be a translucent and add a subtle glow effect.

  • Particles: Added a threaded particle system. This makes things come to life, I added basic explosions and engine trails, but they are really ugly because I can't draw ;). I am working on that "star dust" thing right now, which will be hard because I cannot reposition particles right now to implement an infinite scrolling cube, only spawn new particles.
I attached a few screenshots.

Attached Thumbnails

  • Space 2012-12-25 20-51-01-41.png
  • Space 2012-12-25 20-51-25-01.png
  • Space 2012-12-25 21-00-47-53.png
  • Space 2012-12-25 21-08-27-45.png



PARTNERS