D3D Sprite Object

Hello everyone,

I've been using the D3D Sprite object to create a simple sprite based game.  Everything was going accordingly until it came to scroll the camera.  After trying many implementations and reading conflicting resources I've come here asking for help.

My objective:  Center the camera on an object that moves around the world. 
The problems: Setting the device.Transform.View matrix does nothing.
Setting the sprite.SetWorldViewLH(myWorld, myView) crashes the application.
Setting the sprite.Begin(SpriteFlags.ObjectSpace) flag does something, but I cant see any of my objects.

When I don't set any view matrix or use the ObjectSpace flag the game runs fine, however the camera is fixed.

Any suggestions

Thanks....


Answer this question

D3D Sprite Object

  • Holden

    hrm, thanks for the suggestion, but I can imagine this becomming cumbersome if I wanted to add any camera effects.

    I did fix the crash.  The call to SetWorldViewLH must be executed before any sorting or billboarding takes place.  This doesn't fix the problem however since the view never appears to move.

    Thanks


  • mblack

    no need to move the camera if you can move the sprites like daniel said.

    there appears to be some sort of issue with matrix's when the camera is compleatly verticle... so just move the sprites


  • rmedcalf

    There was some time since I used sprites, but if I'm right you supply a center point when you chose to draw one. I simple sulotion to your problem would be to manually transform that centerpoint for each sprite you draw. It would be something like:
    MyObject.WorldCenter = MyObject.Position - MyCamera.Position;

    Maybe you'll need to test this without SpriteFlags.ObjectSpace when you call begin.



  • D3D Sprite Object