I want to change the color of the target object that I created with V_Real Builder every time it is repeated

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Parallel Computing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!