A question on how to move a character.

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
andy0482
Posts: 23
Joined: Mon Sep 13, 2004 6:22 pm

A question on how to move a character.

Post by andy0482 »

Alright here is what I am trying to do.

I have a camera that stays above and looks down at the character (Think Diable and RTS games). The angle of the camera does not change. So what I want is when I click somewhere on the ground mesh the character will walk there. From the colisition example it uses the direction the camera is facing. This will not work I need where the mous is clicking. If someone can show me how to get the coords in 3D space where the mouse clicked on the mesh then I think I can get the character to walk there.

Thanks
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

im not great coder

Post by TheRLG »

Hey, i dont really know much about this stuff...but all i can say is how i would work through it pseudo-like:

-on mouse click, record coord's
-set path for character to new coord's

for setting the character's path, i think you would have to do some kind of geometry stuff, with slope or something. again, im not a great coder, but just trying to help.
andy0482
Posts: 23
Joined: Mon Sep 13, 2004 6:22 pm

Thx for the Help but I know that part

Post by andy0482 »

Thx for the Help but I know that part

What I was looking for was how to turn the screen cords into the point where the first poly hits at that screen coord.

Thx
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

first you must make a trinalge selector for your mesh
then, using the ISceneCollisionManager interface (obtainable from ISceneManager) you can get a ray from the mouse position. You can then use ISceneCollisionManager::getCollisionPoint (i think that's the name of the function) and pass it your triangle selector. This function will tell you where on the mesh the ray hits.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
andy0482
Posts: 23
Joined: Mon Sep 13, 2004 6:22 pm

getRayFromScreenCoordinates

Post by andy0482 »

Thanks

After some huntingI found this handy function

getRayFromScreenCoordinates

ThX to all
Guest

Post by Guest »

maybe if your using a physics engine, you could make a person an object such as a ball, set a extremelt low friction coefcient

rawstar7
Post Reply