Game Development Community

Coding Mouse Control Question

by Leon Tee · in Torque Game Engine · 01/29/2003 (8:20 am) · 4 replies

Is it possible in V12 to have an arm move on the screen relative to a player's mouse movements? e.g. Aiming and shooting at a target at the left of the screen would mean that the gun and shooting arm are pointing towards the target (instead of changing the view and the gun pointing to the center of the screen).

If so, would code have to be changed within the engine or could it be done simply in TorqueScript?

Sorry if the answers are blatently obvious
Was a noob ... still a noob :)

#1
09/07/2004 (12:34 am)
The same question I want.
#2
09/07/2004 (2:37 pm)
Certainly is possible. It would probably involve C++ work.

You'd want to cast a ray to the mouse position to figure out where your gun is aiming, then do a bit of geometry to aim the arm properly.t
#3
09/07/2004 (5:57 pm)
Cound you post example codes,please?thanks.
#4
09/07/2004 (11:27 pm)
I'm afraid that I can't post any code off hand that will be useful to you.

You will want to look at Container::castRay and TSShapeInstance, especially the node management stuff.