Object Selection Help
by Tray Weeds · in Torque Game Engine Advanced · 01/30/2009 (7:05 pm) · 4 replies
Ok, I implemented the object selection resource - the combined one with camera, mouse and selection into TGEA - works great, so a big thanks to Ehab and all the others who put time into it, only a few minor tweaks. Everything seems to work great up to this point, but here's my problem - hoping someone has seen something similar and can point me in the right direction - I think it's got to be something simple.
I took stronghold demo and added the stock ammo pak to the game - these come with the game are implemented as ItemData blocks so ItemObjectType during game play. The mouse selection works great on it, I can double click on it with the mouse and my %scanTarg works fine, it recognizes that I double clicked on an ammo pak - when searching for:
%searchMasks = $TypeMasks::ItemObjectType | $TypeMasks::ShapeBaseObjectType | $TypeMasks::StaticObjectType | $TypeMasks::StaticTSObjectType;
Then I modeled a simple cube in maya to see how easy it would be for me to add new items to the game. I put a collision mesh on the object and created a new ItemData block for it - same format as the ammo pak. Then I added the object to the game. My player collides with this new object, meaning it is not able to walk through it, so I know the collision mesh is working. However when I double click on it, the ray casting returns to me only the terrain, so it's as if the ray cast goes right through this new item, straight to the ground.
Any idea?
The ItemData blocks between the stock ammo pak and my new item are identical other than the shapeFile pointing to the different .dts. My player collides with both items, but the double click only catches the ammo pak.
It's got to be something simple that I've overlooked? Any ideas from the collective brain? I feel like this is something that I've looked at for 10 hours, and will be a 5 minute correction...
I took stronghold demo and added the stock ammo pak to the game - these come with the game are implemented as ItemData blocks so ItemObjectType during game play. The mouse selection works great on it, I can double click on it with the mouse and my %scanTarg works fine, it recognizes that I double clicked on an ammo pak - when searching for:
%searchMasks = $TypeMasks::ItemObjectType | $TypeMasks::ShapeBaseObjectType | $TypeMasks::StaticObjectType | $TypeMasks::StaticTSObjectType;
Then I modeled a simple cube in maya to see how easy it would be for me to add new items to the game. I put a collision mesh on the object and created a new ItemData block for it - same format as the ammo pak. Then I added the object to the game. My player collides with this new object, meaning it is not able to walk through it, so I know the collision mesh is working. However when I double click on it, the ray casting returns to me only the terrain, so it's as if the ray cast goes right through this new item, straight to the ground.
Any idea?
The ItemData blocks between the stock ammo pak and my new item are identical other than the shapeFile pointing to the different .dts. My player collides with both items, but the double click only catches the ammo pak.
It's got to be something simple that I've overlooked? Any ideas from the collective brain? I feel like this is something that I've looked at for 10 hours, and will be a 5 minute correction...
About the author
#2
06/10/2009 (8:45 pm)
Hey Tray, Are all the parts of that post necessary? I've got all the files copied over into my TGEA build but.. I'm not sure what really needs to be changed. Instructions for TGEA are vague.
#3
However, I do remember a few code changes that I had to make, if you run into, or have specific, problems with the code let me know, and I can help out.
06/10/2009 (10:41 pm)
My errata had less to do with the code and more to do with the bounding box covering up the collision, or the collision covering up the bounding box, I forget which one. However, I do remember a few code changes that I had to make, if you run into, or have specific, problems with the code let me know, and I can help out.
#4
,so I add a "Reply" here,Looking forward to your reply,Thanks again.
02/16/2011 (7:54 pm)
Hi,Tray Weeds,Would you like me enjoy your object selection resource for TGEA ? I want to implement object selection into TGEA 1.8.2. But I encounter a problem when I finish all steps of the solution which provided by Dave Myers.I get the correct object ID which I selected, but the bounding box is not shown. why? would you help me? Thanks very much.My email is : torque_sdk@163.com. I do not know how to contact you,so I add a "Reply" here,Looking forward to your reply,Thanks again.
Associate Matt Fairfax
PopCap
A simple cube *should* be convex but I would recommend checking over it carefully.