HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] region nodes & triggers  (Read 1262 times)

sebako

  • General Accounts
  • *
  • Posts: 6
    • View Profile
[Resolved] region nodes & triggers
« on: Nov 20, 10, 08:30:06 PM »

Hey Guys,

just want to know if there is a way to resize triggers like you can do it with region nodes?
Or the opposite, is there a way to check if a player have entered a certain region?
also it would be nice to know what the UserData Field on Triggers is used for, or if there is a way to find out which trigger send the event.

Would be great if either some of this would work. Appreciate any help.

Cheers

Seb
« Last Edit: Oct 31, 12, 04:00:03 PM by HE-Cooper »
Logged

HE-CHRISTOPHER

  • HeroEngine
  • *****
  • Posts: 424
    • View Profile
Re: region nodes & triggers
« Reply #1 on: Nov 30, 10, 02:36:44 PM »

just want to know if there is a way to resize triggers like you can do it with region nodes?
Or the opposite, is there a way to check if a player have entered a certain region?
also it would be nice to know what the UserData Field on Triggers is used for, or if there is a way to find out which trigger send the event.

Triggers do not utilize the free-form bounds definition used by Region Nodes due to the increased cost of processing events for an arbitrarily complex (and potentially concave) volume.

Judicious use of an external function can determine whether or not a point is in a particular region node.

Code: [Select]
// Returns true if POINT is contained in the volume defined by the specified REGIONNODE, false otherwise.
external function IsPointInRegion( regionNode as NodeRef, point as Vector3 ) as Boolean

UserData is used to store any arbitrary data desired (as a string), it is up to the scripts to utilize that data.  In the case of function calls, the "me" node is set to the trigger allowing you to check the trigger's properties such as Name or UserData.  (Methods of course set the me node to reference the trigger whose method was just invoked).

client

Code: [Select]
// client property access through properties interface
function Foo_TriggerEnter( triggeredBy as noderef )
  where me is kindof HBnode
    trigger_data as string = me["UserData"]
  .
.

server

Code: [Select]
function Foo_TriggerEnter( triggeredBy as noderef )
  where me is kindof TriggerInstance
    trigger_data as string = me.UserData
  .
.



The difference in how you access the trigger's data has to do with the difference between properties on the client vs fields used to persist those values on the server (in the DOM).

http://hewiki.heroengine.com/wiki/Triggers
Logged
Christopher Larsen
CTO
HeroEngine