Erik Bligh
Registered User
Join date: 25 Feb 2006
Posts: 27
|
02-27-2007 20:36
Hey guys, back again. I have an object that responds to a click by changing texture. The only problem is that I have to click each prim in order for it to change. Is there a way for the entire object to act touched when only one prim truly is?
Edit: Also, sometimes only the root prim changes.
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
02-27-2007 21:26
Clicking on a child prim will, by default*, pass the touch to scripts in the root prim. However, touches cannot be passed from root-to-child or child-to-child. The best way to do what you want would be have a single touch handler in a root prim script and have that broadcast a link message to the children to do whatever. Root: default { touch_start( integer Num ) { // Note, this is an "empty" message llMessageLinked( LINK_ALL_CHILDREN, 0, "", "" ); } }
Children: default { link_message( integer Sender, integer Num, string Str, key ID ) { // Code here will be executed whenever // any part of the object is touched } }
*If you have a touch event handler in a child prim, only that child's touch event will be raised, unless you call llPassTouches( TRUE ) before a touch (e.g., in it's default state_entry handler). This will cause the touch event in the root to also be raised when that child prim is touched.
|