[Dir3d-l] using 3d nodes as ancestors

Danny Kodicek dragon at well-spring.co.uk
Wed Jul 13 11:51:09 EDT 2005


> Hey,
>
> Since this isn't touched upon too frequently, I'd thought I'd just say how 
> incredibly useful this feature is. You can have a script instance, say: 
> object_bomb, exposing a method called explode().
>
> You can have the object_bomb script set the model it uses as its ancestor, 
> so you can mix & match normal code, and 3d related tasks:
>
> myBomb.worldposition = vector(10,10,0)
> myBomb.rotate(20,30,20)
> myBomb.parent = pm3D.model("car")
>
> but also your custom methods:
>
> myBomb.explode()
>
> You can use groups, models, lights, cameras, whatever you want as an 
> ancestor, being able to override all calls to the 3d element (such as 
> rotate), add calls to the element (such as explode()).

And although Lucas didn't mention it, it's worth pointing out that you can 
do this with other inbuilt objects to create wrappers for them: set a cast 
member as an ancestor to an object, then you get all its inbuilt methods and 
properties for free.

Danny 



More information about the Dir3d-l mailing list