Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

Accessing model inside object

All about the StoneScript

Accessing model inside object

Postby 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.
ARCoder
Fresh Boarder
Fresh Boarder
 
Posts: 5

Re: Accessing model inside object

Postby 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.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3563
Location: Berlin - Germany

Re: Accessing model inside object

Postby 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.
ARCoder
Fresh Boarder
Fresh Boarder
 
Posts: 5

Re: Accessing model inside object

Postby 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.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3563
Location: Berlin - Germany

Re: Accessing model inside object

Postby 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
Fresh Boarder
 
Posts: 5

Re: Accessing model inside object

Postby 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
Gold Boarder
Gold Boarder
 
Posts: 216


Return to Game programming