Rotating a sprite

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
jjokiranta
Posts: 2
Joined: Wed Oct 10, 2007 7:20 pm

Rotating a sprite

Post by jjokiranta »

Hi,

I'm new to Irrlicht Engine and I have intended to use it to write a 2D space game.

I would like to know if it is somehow possible to draw a rotated and scaled texture using Draw2DImage method?

Or is there some simple 3D technique which I could use to create 2D graphics?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: Rotating a sprite

Post by rogerborg »

jjokiranta wrote:I would like to know if it is somehow possible to draw a rotated and scaled texture using Draw2DImage method?
Not using that method, no.
Or is there some simple 3D technique which I could use to create 2D graphics?
It's relatively simple to do, but there's no direct built in support or SDK examples for it.

First, you'll want to use an orthogonal camera. ICameraSceneNode::setIsOrthogonal(true);

What you'll need to do is to create scene nodes with a simple quad mesh (see source\Irrlicht\CBillboardSceneNode.cpp) and apply a texture to it. Then you can rotate and scale it using setScale() / setRotation() as normal.

If you hop on #IRC, I'm sure there'll be someone there who's done 2D with Irrlicht who'll be able to give detailed assistance.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
jjokiranta
Posts: 2
Joined: Wed Oct 10, 2007 7:20 pm

Post by jjokiranta »

Thank you very much. I'll take a look on the orthogonal camera approach.

Will there be any problems with texture dimensions? I know that texture dimensions should be in powers of 2. My space ships are going to hover on top of 800x600 static images.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Post by suliman »

oh
I tried to do pseudo 2d with irrlicht and it was a PAIN in the A. If the game is truely 2d, check out HGE engine. Its very worked through and covers everything you need in a 2d game, trying to do it in irrlicht instead will be veery timeconsuming.

Also i dosnt seem that irrlicht support easy and fast rescaling and rotation of 2d sprites. Check out the 1000 hares example in HGE. Its pretty impressive.

E
jrm
Posts: 111
Joined: Tue Dec 13, 2005 8:57 pm

Post by jrm »

hge looks nice.. may run on older PCs. Alot of us want to do a game, but are not able to do 3d modeling, we struggle enough with 2D. I may go to that engine. Unless I can figure out how to do a 3rd person game better using 3d stuff. I know there is the 3rd person camera, but can I do a 2d tiled map with it? and what would be the best way. I could probably get a model for my character.. but like I said many of us don't know 3d modeling.

thank you,

jrm
Post Reply