New to Irrlicht

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
magikos
Posts: 7
Joined: Tue Sep 20, 2005 7:23 pm

New to Irrlicht

Post by magikos »

Hi everyone, I am new to Irrlicht and I'd like to say I really love it so far. I have just a few questions I was hoping to see answered.

1) I see how to draw a 2D line on the screen, but how do I draw a 2D circle? I need to draw a circle around one of my objects.

2) I need to know what object is under my cursor - I've played with this, but seem to keep selecting my camera node or the skybox node??

3) How do I skin/change the look of the UI elements?

4) How do I know when a UI element has focus or is being dragged, a window element for example?

I humbly request any and all help.

Thank you
Foole
Posts: 87
Joined: Mon Aug 29, 2005 10:08 am

Post by Foole »

For #2, I use the id field when creating an object and the idBitMask field when calling any of the GetSceneNodeFrom functions.

eg:

Code: Select all

	public enum ObjId
	{
		Map = 1,
		Camera = 2,
		OurChar = 4,
		OtherChar = 8,
		Light = 16,
	}

Code: Select all

mNode = Global.Scene.AddAnimatedMeshSceneNode(mesh, null, (int)(IsPlayer ? ObjId.OurChar : ObjId.OtherChar ));

Code: Select all

selectednode = Global.Scene.SceneCollisionManager.GetSceneNodeFromScreenCoordinatesBB(Global.Device.CursorControl.Position, (int)ObjId.OtherChar);
This makes it so I will only get 'other char' objects.
magikos
Posts: 7
Joined: Tue Sep 20, 2005 7:23 pm

Post by magikos »

Thanks, I see now what I was doing wrong on object selection - however, for some reason I'm not able to get back my mesh object, only my billboard object:

Code: Select all

device.SceneManager.AddBillboardSceneNode(null, new Dimension2Df(10,10), new Vector3D(0,0,0), 2);
device.SceneManager.AddAnimatedMeshSceneNode(planetMesh, null, 4);

Code: Select all

node = device.SceneManager.SceneCollisionManager.GetSceneNodeFromScreenCoordinatesBB(mouse, 2|4);
Any idea what I am doing wrong there?

Thanks again!
magikos
Posts: 7
Joined: Tue Sep 20, 2005 7:23 pm

Post by magikos »

Just to give you an idea of where I am going, this is a concept drawing of my application:
Image

And this is what I've got so far...
Image

I have a long way to go. :wink:
Foole
Posts: 87
Joined: Mon Aug 29, 2005 10:08 am

Post by Foole »

That code looks ok to me, and the concept picture looks pretty cool 8-)

Do you just get a null return value when it should return the mesh?
magikos
Posts: 7
Joined: Tue Sep 20, 2005 7:23 pm

Post by magikos »

Right, as you can see I have a sun and a planet. The sun is a billboard (two actually spinning on top of each other in opposite directions to give it a sparkling effect)

Code: Select all

node = device.SceneManager.SceneCollisionManager.GetSceneNodeFromScreenCoordinatesBB(mouse, 2|4);
This code returns the sun when the mouse is over the sun (as expected), however node == null when I am over the planet. :?:

Thanks for the complement on the concept! Now if I can just make it real, that's the big trick! I think I can do it with Irrlicht from what I've seen, it will just take time. I don’t know c++, so I am working with the Irrlich.NET.dll using C#. I can read c++, but I don’t know the syntax so I couldn’t write it.

I really appreciate all the help you are giving me, thanks!
Foole
Posts: 87
Joined: Mon Aug 29, 2005 10:08 am

Post by Foole »

If you call it with the mask set to 4, do you still get null?
magikos
Posts: 7
Joined: Tue Sep 20, 2005 7:23 pm

Post by magikos »

Yes, I thought to try that, and setting my mesh object to ID 2 and try, both resulted in node == null

:(
magikos
Posts: 7
Joined: Tue Sep 20, 2005 7:23 pm

Post by magikos »

Ok, so I thought: "Maybe it’s my actual mesh giving me problems?" I'm using earth.x from the media directory. I changed it to dwarf.x and <BOOM> it started working! :D

I do wonder though what is wrong with earth.x that prevented it from being detected. :?:

Well, I wasn’t planning on using the example media files as my project grows so that isn’t a big issue. Now to other things in my attempt to build my concept screen.

Thanks for you help, I'll be sure to post again when I get stumped!
Joe_Oliveri
Posts: 448
Joined: Tue Oct 05, 2004 3:24 am
Location: Boston, MA

Post by Joe_Oliveri »

That looks nice much like Homeworld, Keep up he work and you will have my support! :)
Irrlicht Moderator || Game Designer
Learn the basics at </dream.in.code>
magikos
Posts: 7
Joined: Tue Sep 20, 2005 7:23 pm

Post by magikos »

Thanks Skater, I'm working on the interface now and I'm not sure what’s the best way to do it. I tried using Draw2DImage to put my interface buttons at the bottom of the screen, but it isn’t drawing my image correctly - it somehow degrades the quality. But I'm not sure if this is the best approach in the first place as I don’t know how to detect if my mouse is over a particular button etc.

Can anyone give me some suggestions as to how they would reproduce my concept screen and interface?

Thanks!
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

Lookin' pretty sharp there Magikos (the concept work), I'm jealous :)

To help you with some of your questions:

#1 you could plot really small lines and make a circle, although that would be slow.... I'd like to do this myself, I want to rewrite the line drawing code to be faster and allow for curved lines (ellipses, circles) I just use draw2Dline for now

#3 there's a GUIEnvironment call to set the gui skin parameters, and I believe the mesh viewer tutorial shows how this can be done.

#4 as far as I know, there is no way to tell if a window is being dragged, I needed to save window positions when my editting app exited, so what I did is whenever a window receives a focus lost event (or element left event, can't remember) it checks it's current position and updates it internally so that when the app closes it can save this information.
Guest

Post by Guest »

can you just dl the dx managed sdk, and draw a circle with that library in the irrlicht window?
Locked