Rotate an object with makehgtform - zrotate only around the origin

5 views (last 30 days)
Hey everyone,
I'm trying to use a slider and rotate a sphere. It works if the sphere is in the origin. but my sphere is at point (2.5,2.5,7.5) when I rotate it, the entire sphere rotates still around the origin. I want it to stay in the point and just spin.
My code: this is my slider function
function slider_callback1(hObject, eventdata)
s1 = get(slider, 'value');
R1 = makehgtform('zrotate', s1);
set(t1, 'Matrix', R1);
drawnow;
end
Where
t1 = hgtransform;
set(sphere_1, 'Parent', t1);

Answers (0)

Categories

Find more on Object Containers 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!