Page 1 of 1

Drawing a cyliner

Posted: Fri Dec 21, 2007 9:16 pm
by Caspian
I'm trying to create a cylinder scene node... but I don't see any sort of "addCylinderSceneNode" method -- is there any way to add a cylinder without having to create my own custom scene node?

I looked into custom scene nodes, and I really don't want to dive into specifying all the triangles myself (especially since my cylinder will be stretching and rotating). If there's an easier way, I'd be very happy :).

Thanks!

Re: Drawing a cyliner

Posted: Fri Dec 21, 2007 9:35 pm
by vitek
Caspian wrote:I'm trying to create a cylinder scene node... but I don't see any sort of "addCylinderSceneNode" method
Nope there isn't one. I'm glad to hear that you looked before posting. :)
Caspian wrote:is there any way to add a cylinder without having to create my own custom scene node?
Yes. You can use an IMeshSceneNode. You can either make the cylinder in a modelling program and then load the mesh like the example programs do for more complicated meshes, or you can create your own mesh buffer, stuff that into a mesh and set the mesh for the scene node.
Caspian wrote:I looked into custom scene nodes, and I really don't want to dive into specifying all the triangles myself
Then the best thing to do is to find or make a model of a cylinder and use that.
Caspian wrote:especially since my cylinder will be stretching and rotating
Scale and rotation can be done independently from the mesh. If you are going to scale and rotate the cylinder often, you would make a single cylinder primitive that has fixed dimensions [say a diameter of 1 and a length of 1]. If you wanted to make the diameter grow, you would apply a scale factor to the scene node that holds the mesh. So to make the cylinder 2x as tall, you set the scale to core::vector3df(1, 2, 1).

Travis

Posted: Sat Dec 22, 2007 7:31 am
by Caspian
Thanks, vitek!

I created a cylinder using Blender and imported it (it was easier than I thought!)

I had thought that for something as simple as a cylinder I wouldn't need a "custom" scene node... but, oh well ;)

Thanks for your help :D.