I want to change the color of the target object that I created with V_Real Builder every time it is repeated
1 次查看(过去 30 天)
显示 更早的评论
clc;clear;close all
Myworld = vrworld('MyCicle1.x3d');
%%
open(Myworld);
%%
figMy = view(Myworld, '-internal');
vrdrawnow;
%%
GMy=get(Myworld)
%%
NMy=nodes(Myworld);
%% Accessing VRML Nodes
Cicle = vrnode(Myworld,'ObjectCicle');
%%
Cicle.translation = [0 0 0];
x1 = 1:15 ;
y1 = 0 + zeros(size(x1));
z1 = 0 + zeros(size(x1));
Ch=Myworld.ObjectCicle.children;
c1=getfield(Ch);
c2=getfield(c1.appearance);
c3=getfield(c2.material);
for i=1:length(x1)
Cicle.translation = [x1(i) y1(i) z1(i)];
c3.diffuseColor = rand(1,3);
vrdrawnow;
pause(1)
end
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!