Drawing Mesh as cursor

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Guest

Drawing Mesh as cursor

Post by Guest »

I want to show several loaded models (meshes) and let the user pick them and move them around (as the cursor), what would be a good method
to achieve this ?
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

You could just get the current position of the cursor each frame and update the position of two of the axis ( i.e. the two facing the camera ) but that would be pretty slow.

Couldn't you just use a billboard of what you are dragging when you "pick up" a mesh? Seems to me that it would be a lot easier.
Guest

Post by Guest »

billboards are not really the solution.
I try explain again what i want to do:
i want irrlicht to render a level (OctTree) and from a library (prefabs) i want to pick up meshes and place them in the level.
I want also just to render a mesh (still being able to scale) and moving it around on the 2d screen.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Like a modelling tool? That's possible. There may be a better way but I would update the mesh position while the cursor returns a LMB press, as long as the the cursor is pressed you are dragging the mesh, then just update the mesh positions from the cursor position. You'd have to find some way of changing the axis being moved ( XY, XZ etc ) you could do that by using the RMB as well.
Serg Nechaeff
Posts: 162
Joined: Wed Nov 26, 2003 5:24 pm
Location: Europe

Post by Serg Nechaeff »

here you may move the object within x (-300,300) and y (-220,200) axis:

Code: Select all

   position2d<f32> m = m_device->getCursorControl()->getRelativePosition ();
	vector3df v = nodPlayer->getPosition();
	
    if (m.Y>0.5f && v.Y>-220 ) v.Y-=10;
	if (m.Y<0.5f && v.Y<200  ) v.Y+=10;

    if (m.X<0.5f && v.X>-300 ) v.X-=10;
	if (m.X>0.5f && v.X<300  ) v.X+=10;

	m.X=0.5f;
	m.Y=0.5f;

	m_device->getCursorControl()->setPosition (m);

	nodPlayer->setPosition(v);
hope you get the idea
http://www.javazing.com
P-III-950, WinXP, GeForce FX5600 128 MB ForceWare 52.16, DX9, Eclipse IDE, JRE 1.6
Guest

Post by Guest »

thanks for the hints.
Is it possible to have irrlicht to render 2 different "worlds" at the same time ?
I mean the scene-menger haveing 2 separate worlds.
What i want to do is (yes, its sort of modelling tool) to render models in a separate window an show them independent from the actual level.
Serg Nechaeff
Posts: 162
Joined: Wed Nov 26, 2003 5:24 pm
Location: Europe

Post by Serg Nechaeff »

i dont know :) you have to check it out yoself!
http://www.javazing.com
P-III-950, WinXP, GeForce FX5600 128 MB ForceWare 52.16, DX9, Eclipse IDE, JRE 1.6
Post Reply