|
Hi Ender,
Ender wrote:
> "Roberto " <rbunge@stanford.edu> wrote in message
> <j2blo8$gf8$1@newscl01ah.mathworks.com>...
>> "Ender " <jr147@msstate.edu> wrote in message
>> <j1uebl$pcn$1@newscl01ah.mathworks.com>...
>> > I am trying to figure how to use the Simulink 3D animation toolbox
>> in MATLAB. I am currently working with the car in the mountains demo.
>> I can run the program when I follow the tutorial however I would like
>> to alter the 'Fields' commands for the car model. How do I add
>> children to the model?
>> > > I have tried this command:
>> > > % Access car node
>> > car = vrnode(world, 'Automobile');
>> > > % Change car characteristics
>> > kids = setfield(car,'addChildren','on');
>> > > , but I get this error:
>> > > ??? Error using ==> vrnode.setfield
>> > Too many output arguments.
>> > > What am I doing wrong?
>> > > --Ender--
>>
>> Ender, I believe setfield() is a method, so it doesn't make sense to
>> assign it to a variable "kids" since you are modifying something, not
>> pointing or creating something. Instead, try simply
>>
>> setfield(car,'addChildren','on');
>>
>> Something that has helped me tremendously is the Virtual Reality
>> Toolbox Manual, especially the last part where you go to the nuts and
>> bolts of World, Nodes and Figures. Let me know how it goes.
>>
>> Best,
>> Robbie
>
> Not so good. I am going to look at the Virtual Reality Toolbox because
> when I typed in what you wrote I got an error:
>
> ??? Error using ==> vrsfunc
> No field 'Children' of type Transform found in node 'Automobile'.
>
> Error in ==> vrnode.setfield at 37
> vrsfunc('VRT3SetField', getparentid(node(i)), node(i).Name,
> fieldname{j}, fieldval{i,j});
>
>
> The error was because I did not list the additional information that the
> specific line of code was expecting. I am going to look at the tutorial
> which should hopefully shed some light on the subject.
If you want to add new nodes into an existing world, please use the
"vrnode" function. E.g. like this:
car = vrnode(world, 'Automobile');
newnode = vrnode(car, 'children', 'MyBox', 'Box');
The above example addes a node named "MyBox" of type "Box" to the field
"children" of the parent node "car". For more information please see
"help vrnode".
Good Luck, Jan
--
Jan Houska HUMUSOFT s.r.o.
houska@humusoft.com Pobrezni 20
http://www.humusoft.com 186 00 Praha 8
tel: ++ 420 284 011 730 Czech Republic
fax: ++ 420 284 011 740
|