Thread Subject: 3D animation demo

Subject: 3D animation demo

From: Ender

Date: 10 Aug, 2011 17:15:33

Message: 1 of 4

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--

Subject: 3D animation demo

From: Roberto

Date: 15 Aug, 2011 17:41:28

Message: 2 of 4

"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

Subject: 3D animation demo

From: Ender

Date: 15 Aug, 2011 21:15:31

Message: 3 of 4

"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.

--Ender--

Subject: 3D animation demo

From: Jan Houska

Date: 23 Aug, 2011 10:11:15

Message: 4 of 4

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

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
3d animation Ender 10 Aug, 2011 13:19:29
rssFeed for this Thread

Contact us at files@mathworks.com