Game Development Community

Mouse Controlled Movement

by Robert Stewart · in Torque Game Engine · 10/20/2004 (7:28 pm) · 5 replies

Sorry i reposted this in here just incase "Disscusion" wasent the right place for it. Anyway here is my topic.
Well, im new to tourqe just got this today, here is my question.
I cannot get the resource "Object selection in Torque" to work for the latest stable release of tourqe, i compile fine, i use printf for mousedown and it works when i click the screen, so problem must be somewere else/past step 2 in that resource? if anyone has this working i could use some help, and when i get this working i would like to use mouse controlled movements resource, if you could help me with that also? sorry its just both resources are so old compared to this version of tourqe, thanks for any help. bye

EDIT: for people wondering what this has to do with topic, i need "Object selection in Torque" resource to work before i can get "Mouse Controlled movement" resource to work i think?. thanks again

#1
10/20/2004 (7:37 pm)
I got the Object Selection Resource to work with the latest head, but I would have to backtrack to remember how. I'm assuming you are using this resource. Be sure to scroll down near the bottom and you'll find these changes that need to be made:

Quote:
Summary of changes needed to get Dave Meyers' object selection tutorial to work with a clean checkout of Torque 1.2.2.



in Step 1:
----------

Instead of fps/client/scripts/default.bind.cs
put the code into a new file, fps/client/scripts/mine.cs,
and in init.cs, exec that file right after config.cs.


As noted elsewhere,
when adding to class GameTSCtrl in gameTSCtrl.h, also add:
static void consoleInit();




in Step 2:
----------

´SelectObject´
should of course be:
'SelectObject'




in Step 3:
----------

the GameConnection constructor no longer has any arguments.
paste the code in there anyhow.


the cGetControlObject() function no longer exists.
that's fine, paste the new code above consoleInit().

also, note that the tutorial is telling you to Add code
to consoleInit(), not make a new consoleInit().



in Step 4:
----------

no problems, but you may want to expand %searchMasks to:
%searchMasks =
$TypeMasks::StaticObjectType | $TypeMasks::EnvironmentObjectType | $TypeMasks::TerrainObjectType |
$TypeMasks::InteriorObjectType | $TypeMasks::WaterObjectType | $TypeMasks::TriggerObjectType |
$TypeMasks::MarkerObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::GameBaseObjectType |
$TypeMasks::ShapeBaseObjectType | $TypeMasks::CameraObjectType | $TypeMasks::StaticShapeObjectType |
$TypeMasks::PlayerObjectType | $TypeMasks::ItemObjectType | $TypeMasks::VehicleObjectType |
$TypeMasks::VehicleBlockerObjectType | $TypeMasks::ProjectileObjectType | $TypeMasks::ExplosionObjectType |
$TypeMasks::CorpseObjectType | $TypeMasks::DebrisObjectType | $TypeMasks::PhysicalZoneObjectType |
$TypeMasks::StaticTSObjectType | $TypeMasks::GuiControlObjectType | $TypeMasks::StaticRenderedObjectType |
$TypeMasks::DamagableItemObjectType ;



in Step 5:
----------

no problems

It was mostly the "´" crap that was screwing mine up, but there were a couple other changes I had to make as well.
#2
10/20/2004 (7:43 pm)
Yes, i did all that and checked through really good, i still cant select anything, but mousedown as mentioned is been called, thanks for quik reply, and i hope i get this working soon.
#3
10/20/2004 (7:50 pm)
Well, clicking is kind of wanky. The hitbox doesn't seem to be very big for most things, and I could only select certain objects (I don't think I was ever able to click on a weapon or ammo). Clicking on the bot worked fine though.

I wasn't interested in clicking on objects though. Like you, I wanted to click on the world. So I just added the new OnMouseDown code anyway. To verify the clicks were being registered, I spawned an explosion... and lo and behold, the explosions occured exacly where I clicked in the world!
#4
10/20/2004 (7:51 pm)
Sorry i should have said this first, i could probraly get Click n Play to work, but Mouse Controlled Movement is built off of "Object Selection" resource

Edit: so if someone can help me to get "Mouse controlled movement" to work with "Click n Play" Resource, it would help allot, thanks
#5
10/20/2004 (7:53 pm)
Well i tried clicking on the Bot, just to clarify. thanks though.
Edit: it still dosent work even on bot