Register  |  FAQ  |  Search  |  Memberlist  |  Usergroups  |  Log in 
Reply to topic
 Interacting with the object in world 
npantic


Joined: 12 Nov 2007
Posts: 19
Reply with quote
Is it possible to intearct directlywith an object (mesh) in the scene, and how ?
Like with inserted 2d picture. Like: On mose over, on press etc on Meh, start playing Shot... ?
View user's profile Send private message
  
awingsoft
Site Admin

Joined: 25 Dec 2006
Posts: 98
Reply with quote
For overlays, you can add Actions in Command Target rollout.
For 3d meshs, you can define Script Variable for object, the operate object by scripting.

Assume you want to do something when user click on a 3d mesh, you can:

1. Define Script Variable for the mesh (in awakening's viewport, rick-click on the mesh, select 'Define Script Variable...')
2. In User Script File, add codes in OnLButtonDown() function:
Code:
if (mesh.intersectRay(GetRayFromPoint(x,y))) then
   print('click mesh, do something...')
end
View user's profile Send private message Send e-mail
  
npantic


Joined: 12 Nov 2007
Posts: 19
Reply with quote
Thanks!

This instruction also pushed me to ge more insigh in how to trigger scripts, etc.
I succedded to start the shot1 by clicking on the mesh in shot0, and on key press to stop the shot1!
I had some problems to "understand" end syntax (new to the lua, but have experience from Javascript, BlitzBasic, Actionscript, PHP... it is all the same Twisted Evil )
I remembered to use Console for debugging, it is a must for a begginer...
I have a question: is there a way to make "Mesh Boundaries" smaller (indicated by green lines - selection) - to make onClick more accurate? I guess it is not the same as Movtar?
View user's profile Send private message
  
Vincent


Joined: 25 Dec 2006
Posts: 296
Reply with quote
Quote:
I have a question: is there a way to make "Mesh Boundaries" smaller (indicated by green lines - selection) - to make onClick more accurate? I guess it is not the same as Movtar?


For mobiles, ray intersection test is accurate to triangles.
For skinmeshs with bones animation, ray intersection test is accurate to bounding box. You can not change mesh's inner bbox, but you can get bbox to a variable, then change the variable and use bbox.intersectRay() to do intersection test.
View user's profile Send private message
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic