how to move the character using mouse

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
dujimache
Posts: 24
Joined: Mon Aug 03, 2009 3:22 am

how to move the character using mouse

Post by dujimache »

Code: Select all

if (mouseDownL == true)
{
						cursor.X = (f32)event.MouseInput.X; 
						cursor.Y = (f32)event.MouseInput.Y; 
						cursorDelta.X = (f32)((cursor.X - cursorOld.X) * 1.0); 
						cursorDelta.Y = (f32)((cursor.Y - cursorOld.Y) * 1.0);
						selectedNode = smgr->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(core::position2d<s32>(cursor.X ,cursor.Y ));
	pos = selectedNode->getPosition();
						selectedNode->setPosition(core::vector3df(pos.X + cursorDelta.X ,0,pos.Z - cursorDelta.Y ));
}
i want to move the character in the scene using the mouse,my codes works bad,when the mouse moves a little,the character moves a lot ,i mean,the character isn't always under the mouse?can somebody give me some help?
Bear_130278
Posts: 237
Joined: Mon Jan 16, 2006 1:18 pm
Location: Odessa,Russian Federation

Post by Bear_130278 »

Your second KB layout is cyrylic ? *))
Do you like VODKA???
Image
Image
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

well i think you could try to print out a cursor delta value somewhere and see how big is it first :wink:
Working on game: Marrbles (Currently stopped).
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

Post Reply