Getting a direction from a x y z to a x y cord
by Trevor "PointDestruction" · in Technical Issues · 02/22/2003 (8:41 am) · 7 replies
not sure if this is possible, but I imagine it is somewhere.
So, lets say I have a x y z cord. of my player, and I want him to face where the mouse is (this is done with something close to the godview, only I have a mouse showing up.
Thx for your help
So, lets say I have a x y z cord. of my player, and I want him to face where the mouse is (this is done with something close to the godview, only I have a mouse showing up.
Thx for your help
#2
could you put it in code more code terms, possibly some quick coding to show.
Not quite sure what you mean by doing that, what do I declare the variable as, etc.
02/22/2003 (11:51 am)
wait - confused :/could you put it in code more code terms, possibly some quick coding to show.
Not quite sure what you mean by doing that, what do I declare the variable as, etc.
#4
example:
so that gives me the point in the world that the mouse is actually at - now how do I orient my my player? I have this code in the
void GameTSCtrl::onMouseMove(const GuiEvent &evt)
located in gameTSCtrl.cc file
02/22/2003 (12:09 pm)
ok I figured out how to get the "worldPoint" from the object selection resource or something like thatexample:
so that gives me the point in the world that the mouse is actually at - now how do I orient my my player? I have this code in the
void GameTSCtrl::onMouseMove(const GuiEvent &evt)
located in gameTSCtrl.cc file
#5
02/22/2003 (12:16 pm)
wait ... I dont think removed ...is going to get me what I need ... argh help! lol
#6
The reason being is this was posted in a non-SDK forum and Trevor "PointDestruction" doesn't own the source code, so your snippets of code do him no good.
02/22/2003 (12:51 pm)
I would suggest removing those snippets of TGE code.The reason being is this was posted in a non-SDK forum and Trevor "PointDestruction" doesn't own the source code, so your snippets of code do him no good.
#7
02/22/2003 (4:11 pm)
alright, code snippets removed - sorry bout that
Torque 3D Owner Pat Wilson
(mouseX - screenCenterX, mouseY-screenCenterY)
Ya may have to reverse those, I'm currently just gotten out of the shower and half dressed. Once you have that you can use it to set the players heading.
Play around with it, it's something like that. If you want to make the player move, then you'll have to cast a ray from the players position along that vector, and it'll tell you the location of the first thing it intersects. Then you can move to that position.