Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: Function documentation  (Read 5034 times)

zzz

  • Sr. Member
  • ****
  • Posts: 266
  • newbie
Function documentation
« on: December 18, 2016, 10:45:29 am »

Can we get some documentation on:

this.$ctx()

specifically on how to get the context of another Object from within a different Object.

and

this.object_test
this.add_weapon

Thanks.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Function documentation
« Reply #1 on: December 18, 2016, 12:41:11 pm »

$ctx returns the context where the object was created. this.$ctx() returns the scope through which you can access the global variables, the same ones that you'd normally access without any $ctx call. Hence, it makes no sense to use it on this, but only on references to other objects that you obtained, if you want to access their globals.

Note all this temporary and will likely go away, as it's no good usage pattern to have scripts accessing stuff arbitrarily.

Code: [Select]
    ///Test if ray from model hits an object
    //@param pos model-space position
    //@param dir model-space ray direction
    //@param maxdist max ray distance to check (keep short if possible)
    //@param exclude_self true if ray should not hit origin body
    //@param joint [optional] bone id to be relative to (with pos, rot arguments)
    //@return {$ret: object hit, norm: hit surface normal vector, hitpoint: world position}
    function object_test( pos, dir, maxdist, exclude_self, joint)

add_weapon is a dummy, does nothing yet.
Logged