ShiVa3D
Accessing model inside object
All about the StoneScriptAccessing model inside object
by ARCoder » 27 May 2012, 09:49
I'm hoping that this is quite straightforward.
I have an object that I use a lot of times in a scene called 'CommandSquare', when I imported the object I opened it in the scene editor and attached an AI model directly to the model.
Then I created the instances in the games scene/level.
When I click on the object in the scene it shows no AIModel, as I expected as the AIModel is inside the object.
My question is, how do I send an event to the AIModel inside the model in the scene?
I looked at group.getSubObjectAt() but that just threw an error, possibly because it's not a group.
I have an object that I use a lot of times in a scene called 'CommandSquare', when I imported the object I opened it in the scene editor and attached an AI model directly to the model.
Then I created the instances in the games scene/level.
When I click on the object in the scene it shows no AIModel, as I expected as the AIModel is inside the object.
My question is, how do I send an event to the AIModel inside the model in the scene?
I looked at group.getSubObjectAt() but that just threw an error, possibly because it's not a group.
- ARCoder
- Fresh Boarder

- Posts: 5
Re: Accessing model inside object
by broozar » 27 May 2012, 10:01
when you attach an AImodel directly to a model, it should also show up in the scene. if not, right click on the instance, and select "update instance from model".
also, to me it's not entirely clear how your scene is set up, which models have an aimodel, which have not, which have subobjects and which have not. a screenshot would help (scene explorer + scene viewer).
if you have a lot of instances of the same base model with all the same AIs, you should store every tile in a table and access them by index.
also, to me it's not entirely clear how your scene is set up, which models have an aimodel, which have not, which have subobjects and which have not. a screenshot would help (scene explorer + scene viewer).
if you have a lot of instances of the same base model with all the same AIs, you should store every tile in a table and access them by index.
Re: Accessing model inside object
by ARCoder » 27 May 2012, 10:19
Let me try and explain the process I used to create my scene better.
1. Imported the model (CommandSquare) into Shiva
2. Double clicked the model in the explorer window to open it
3. In the 3d view of the model (not the scene) I attached the AIModel, saved and closed
4. Created a scene and dropped a number of instances of the model on to it.
5. Selecting the model doesn't show an AIModel in the Attributes Editor.
I'm beginning to think that AIModels should only be attached at the top level of an object, i.e. when it is on the scene rather than editing the model.
1. Imported the model (CommandSquare) into Shiva
2. Double clicked the model in the explorer window to open it
3. In the 3d view of the model (not the scene) I attached the AIModel, saved and closed
4. Created a scene and dropped a number of instances of the model on to it.
5. Selecting the model doesn't show an AIModel in the Attributes Editor.
I'm beginning to think that AIModels should only be attached at the top level of an object, i.e. when it is on the scene rather than editing the model.
- ARCoder
- Fresh Boarder

- Posts: 5
Re: Accessing model inside object
by broozar » 27 May 2012, 13:40
no, actually, it does not matter. i prefer toset the AIs directly onto the models themselves, this way, they should be present even if you instance it a coulpe of times in the scene.
Re: Accessing model inside object
by ARCoder » 27 May 2012, 13:46
Ah OK. So if that's the case how are you sending events to the AI Model attached to the model?
- ARCoder
- Fresh Boarder

- Posts: 5
Re: Accessing model inside object
by freezer » 27 May 2012, 13:48
i had something similar a while back, now to add an ai model i right click on the model and use that menu, for some reason this seems to stay. using the drag and drop method doesnt always stay.
- freezer
- Expert Boarder

- Posts: 155
6 posts
• Page 1 of 1
