My aim is to rotate/translate a few objects (STL) in 3D visualizing a running simulation. And Makie seems to be the way to do it. I started simple with just trying to rotate a cube using an observable updated every 100 ms. However, without success.
The code below runs, a cube is displayed, the observable and the meshplot.transformation is updating but no rotation is visible.
How is this supposed to be done?
using GLMakie
#using Makie
using GeometryBasics
#using StaticArrays
GLMakie.activate!()
fig = Figure()
ax = Axis3(fig[1, 1]; aspect = :data)
cube = HyperRectangle(Vec3f(-1, -1, -1), Vec3f(2, 2, 2))
meshplot = mesh!(ax, cube, color = :lightblue, transparency = false)
linesegments!(ax, [Point3f(0,0,0), Point3f(2,0,0)], color=:red) # x-axis
linesegments!(ax, [Point3f(0,0,0), Point3f(0,2,0)], color=:green) # y-axis
linesegments!(ax, [Point3f(0,0,0), Point3f(0,0,2)], color=:blue) # z-axis
angle = Observable(0.0)
on(angle) do θ
mat = Makie.rotationmatrix_y(Float32(θ))
meshplot.transformation = Transformation(mat)
@show meshplot.transformation
end
@async while isopen(fig.scene)
angle[] += 0.03f0
println(angle[])
sleep(1/20)
end
fig