From 93c70b5ad4c7ff868dd2d8d51bd98d7efd41bc9c Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Fri, 14 Jun 2024 12:22:30 +0200 Subject: [PATCH] don't recenter camera --- docs/src/examples/pendulum.md | 4 ++-- docs/src/examples/robot.md | 2 +- docs/src/examples/ropes_and_cables.md | 4 ++-- ext/Render.jl | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/src/examples/pendulum.md b/docs/src/examples/pendulum.md index 97676c8e..30ae0a04 100644 --- a/docs/src/examples/pendulum.md +++ b/docs/src/examples/pendulum.md @@ -199,8 +199,8 @@ W(args...; kwargs...) = Multibody.world world = W() shoulder_joint = Revolute(n = [0, 1, 0], isroot = true, axisflange = true) elbow_joint = Revolute(n = [0, 0, 1], isroot = true, axisflange = true, phi0=0.1) - upper_arm = BodyShape(; m = 0.1, isroot = false, r = [0, 0, 0.6], radius=0.05) - lower_arm = BodyShape(; m = 0.1, isroot = false, r = [0, 0.6, 0], radius=0.05) + upper_arm = BodyShape(; m = 0.1, isroot = false, r = [0, 0, 0.6], radius=0.04) + lower_arm = BodyShape(; m = 0.1, isroot = false, r = [0, 0.6, 0], radius=0.04) tip = Body(; m = 0.3, isroot = false) damper1 = RDamper(d = 0.07) diff --git a/docs/src/examples/robot.md b/docs/src/examples/robot.md index d25ea11b..cdd675a9 100644 --- a/docs/src/examples/robot.md +++ b/docs/src/examples/robot.md @@ -98,7 +98,7 @@ Multibody.jl supports automatic 3D rendering of mechanisms, we use this feature ```@example robot import CairoMakie -Multibody.render(robot, sol; filename = "robot.gif") +Multibody.render(robot, sol; y=2, lookat=[0,1,0], filename = "robot.gif") nothing # hide ``` diff --git a/docs/src/examples/ropes_and_cables.md b/docs/src/examples/ropes_and_cables.md index 9719609a..3b28f498 100644 --- a/docs/src/examples/ropes_and_cables.md +++ b/docs/src/examples/ropes_and_cables.md @@ -65,7 +65,7 @@ prob = ODEProblem(ssys, [ sol = solve(prob, Rodas4(autodiff=false); u0 = prob.u0 .+ 0.5); @test SciMLBase.successful_retcode(sol) -Multibody.render(flexible_rope, sol, filename = "flexible_rope.gif") # May take long time for n>=10 +Multibody.render(flexible_rope, sol, y = -3, x = -6, z = -6, lookat=[0, -3, 0], filename = "flexible_rope.gif") # May take long time for n>=10 ``` @@ -101,7 +101,7 @@ prob = ODEProblem(ssys, [ sol = solve(prob, Rodas4(autodiff=false)) @test SciMLBase.successful_retcode(sol) -Multibody.render(mounted_chain, sol, filename = "mounted_chain.gif") # May take long time for n>=10 +Multibody.render(mounted_chain, sol, x=3, filename = "mounted_chain.gif") # May take long time for n>=10 ``` ![mounted_chain animation](mounted_chain.gif) diff --git a/ext/Render.jl b/ext/Render.jl index 6e1adf24..6963e80c 100644 --- a/ext/Render.jl +++ b/ext/Render.jl @@ -89,7 +89,7 @@ function default_scene(x,y,z; lookat=Vec3f(0,0,0),up=Vec3f(0,1,0),show_axis=fals # scene = LScene(fig[1, 1], scenekw = (lights = [DirectionalLight(RGBf(1, 1, 1), Vec3f(-1, 0, 0))],)).scene # This causes a black background for CairoMakie, issue link above scene = LScene(fig[1, 1])#.scene # end - cam3d!(scene) + cam3d!(scene, center=false) # scene.scene.camera.view[] = [ # R [x,y,z]; 0 0 0 1 # ] @@ -103,9 +103,9 @@ end function render(model, sol, timevec::Union{AbstractVector, Nothing} = nothing; framerate = 30, - x = 3, - y = 0, - z = 3, + x = 2, + y = 0.5, + z = 2, lookat = Vec3f(0,0,0), up = Vec3f(0,1,0), show_axis = false,