Message 1 of 8
Self referring script controller
Not applicable
09-17-2009
06:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to make what seems like a pretty simple script controller. Lets say something simple like a script that scales the object based on the distance between it's parent node and the camera. The resulting script will be more complicated than that, but that's pretty much my first step.
I wanted to be able to instance this same script to a bunch of different objects so that they would all behave the same way, but independent of each other, so I don't want to directly specify the node I'm working with (other than the camera). And I definitely want to keep the script as an instance if possible.
What i'm looking for something along the lines of a "this.parent_node" operator, where "this" refers to the script controller itself and "parent_node" refers to the node it is attached to, which would vary depending on exactly which instance of the controller is being evaluated.
Is this possible, or am I heading down a dead end here?
I wanted to be able to instance this same script to a bunch of different objects so that they would all behave the same way, but independent of each other, so I don't want to directly specify the node I'm working with (other than the camera). And I definitely want to keep the script as an instance if possible.
What i'm looking for something along the lines of a "this.parent_node" operator, where "this" refers to the script controller itself and "parent_node" refers to the node it is attached to, which would vary depending on exactly which instance of the controller is being evaluated.
Is this possible, or am I heading down a dead end here?