Game Development Community

Mounting Objects In Game

by John Klotz · in Torque Game Builder · 07/31/2006 (8:16 am) · 7 replies

How do you go about mounting an object to another object with in the course of a game. I want an object to mount to another object when they collide. What code withing the collision function would be neccessary to make this happen?


Thanks for any and all help.

#1
07/31/2006 (8:47 am)
The Mount() command :)

if playerClass::onCollision(%srcObj, %dstObj, %srcRef, %dstRef.....){
        %srcObj.mount(%dstObj, .....);
}

Untested, but makes sense. Check the TGB reference for the required parameters.
#2
08/01/2006 (9:35 am)
Thank you very much. I was toying with the mount command before and couldn't get it to work right.

How would one go about mounting something to the mouse pointer? I want to be able to to move the mouse over something, click on it, pick it up(have it mounted to the pointer), and drop it again somewhere else.
#3
08/01/2006 (9:50 am)
Check out the object selection tutorial here. There's "object selection tutorial 1, 2 and 3".
#4
08/01/2006 (9:55 am)
Hmm, it seems like just yesterday that TDN was under construction, and now its full blown Torque mayhem!
#5
08/01/2006 (11:36 am)
Awesome, thanks. I keep receiving the error Unable to find object: 't2dscene' attempting to call function ' setdebugon' when I type in t2dScene.setDebugOn(BIT(1));

I followed the tutorial code for code. Any ideas what I am doing wrong here?
#6
08/01/2006 (11:48 am)
Try typing this into the console:
sceneWindow2d.getScenegraph().setdebugon(1)
I filled this out in the TDN this afternoon. For other debug modes, check this article.
#7
08/01/2006 (3:03 pm)
@John - By default the t2dSceneGraph used to be named t2dScene, but it's no longer named by default. That's why t2dScene could not be found. Apurva's suggestion will work though, as long as you dont rename your scene window.