why function girlNormal::onRightMouseDown(%this, %pos, %start, %ray) doesn't work?
by mafan · in Torque 3D Beginner · 04/19/2011 (9:33 am) · 5 replies
last time when i using tgb, in the scripting tab, in name field i put "girlNormal" , then the following function will work.
function girlNormal::onRightMouseDown(%this, %pos, %start, %ray)
but when i using this function in torque 3D 2009 SDK 1.0.1, why does it didn't work??
function girlNormal::onRightMouseDown(%this, %pos, %start, %ray)
but when i using this function in torque 3D 2009 SDK 1.0.1, why does it didn't work??
#2
The body of the function could contain errors.
Have you set an actual keybind for the right mouse button?
Is girlNormal a datablock or class namespace?
Did you copy the function from TGB and expect it to work inside of Torque 3D?
04/20/2011 (9:55 am)
Sorry, but there is no actual context upon which to offer any real help. This is too vague... and there could be any number of reasons why this wouldn't work. The body of the function could contain errors.
Have you set an actual keybind for the right mouse button?
Is girlNormal a datablock or class namespace?
Did you copy the function from TGB and expect it to work inside of Torque 3D?
#3
function PlayGui::onRightMouseDown(%this, %pos, %start, %ray)
it works well, but if i do
function girlNormal::onRightMouseDown(%this, %pos, %start, %ray)
it cant work.
First I just import a girl.dts to the world editor, then name it as girlNormal. Why does it cannot work?
04/20/2011 (11:31 pm)
erm, thanks for ur reply, my body function is correct, when i use function PlayGui::onRightMouseDown(%this, %pos, %start, %ray)
it works well, but if i do
function girlNormal::onRightMouseDown(%this, %pos, %start, %ray)
it cant work.
First I just import a girl.dts to the world editor, then name it as girlNormal. Why does it cannot work?
#4
Furthermore, importing a shape to the world editor, you mostly likely placed it in the world as a TSStatic shape which has no script accessible functionality or interaction. You would have to create a StaticShape datablock referencing your girl.dts as the shape, and implement your script methods for that datablock, or StaticShape generic class - something a bit more in-depth and custom could work on a scripted class namespace - then you place the scripted object (the datablock) into the world through the editor.
04/21/2011 (12:04 am)
Torque 3D does not work that way. Your function must be a class or datablock method for something like that to work. A generic onRightMouseDown callback most likely is only implemented for the gui system.... or certain movement triggers and animations or state sequences can be bound to be activated from a right mouse click. Furthermore, importing a shape to the world editor, you mostly likely placed it in the world as a TSStatic shape which has no script accessible functionality or interaction. You would have to create a StaticShape datablock referencing your girl.dts as the shape, and implement your script methods for that datablock, or StaticShape generic class - something a bit more in-depth and custom could work on a scripted class namespace - then you place the scripted object (the datablock) into the world through the editor.
#5
04/21/2011 (2:30 am)
so in torque3d, izzit possible for player to click the 3d object and it do something?? My game is control using mouse only, if the 3d obejct is not clickable, mean that torque 3d is not suitable for me? Do you know any good tutorial for me as a newbie? as the doc that provided by garagegame is not good enough for me. The references is too little if compare to torque game builder. HELP...
mafan