Skip to content

Commit

Permalink
don't recenter camera
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Jun 14, 2024
1 parent 0ac06a7 commit 93c70b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/src/examples/pendulum.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples/robot.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples/ropes_and_cables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```


Expand Down Expand Up @@ -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)
8 changes: 4 additions & 4 deletions ext/Render.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ]
Expand All @@ -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,
Expand Down

0 comments on commit 93c70b5

Please sign in to comment.