Game Development Community

Point and Click Mouse Movement...

by Matthew Harris · in Torque Game Engine · 04/02/2006 (4:59 pm) · 6 replies

I am using the GodView from the advanced camera tutorial and I want to add point and click mouse movement for my player. ie wherever the mouse is clicked on the terrain, the player will move to it. Any ideas/suggestions on how to do this. Thanks in advanced.

#2
04/02/2006 (5:15 pm)
That code is just selection of an object, I need selection of terrain, I have implemented the Object Selection resource just confused on how to grab a terrain point and move to it.
#3
04/02/2006 (5:56 pm)
One thing that may work is take a look through the terrain editor on how it does the 3d mouse.
The simple concept for it is you take the mouse's position from the camera's perspective, fire a raycast and see what you hit, if you hit terrain, you could then place a marker there and let the player head that direction.
Given, that's a simple explination, and i'd recommend looking at the editors for a bit more of a working solution.
Hope that helps ya get in the right direction at least :)
#4
04/02/2006 (7:35 pm)
@matt - i'm not sure but i think the object selection resouce allows you to use an ObjectTypeMask which could include terrain in the raycast. you might need to be on the C++ side to get it to work, but i don't think it's a very involved mod.
#5
04/02/2006 (7:48 pm)
You can certainly use the object selection resource with a few adjustments to do what you want--in fact, it was my first foray into Torque doing exactly that! Wasn't very pretty (on my part--the selection resource was pretty ok), but it did work.

Basically, allow collision with the terrain, find the coordinate of the collision in 3 Space, modify your player slightly to allow for basic "moveToDestination" (provided from AIPlayer), and you have a pretty nifty solution.

Or, you can purchase the RTS-SK, since it has all of this for you already written--you would just need to adjust it for a control object instead of a group of RTS Units.
#6
04/02/2006 (8:33 pm)
I was able to get point and click movement, I am using godview with the advanced camera resource. The camera movement is very very choppy. It works but very choppy. I might just end up purchasing the RTS-SK, is there ever going to be a sale on it :)!