Tour camera animation

Show off your FreeCAD projects here!
User avatar
JMG
Posts: 278
Joined: Wed Dec 25, 2013 9:32 am
Location: Spain
Contact:

Tour camera animation

Postby JMG » Fri Nov 14, 2014 11:20 pm

Hi everyone!

I want to share with you a new animation, but this time, what is moving is you!
Little video: Tour Camera

Quick start guide:
Download the model here
Open it, switch to "Perspective View", toggle the visibility of one of the sketches called "track..", select one line of the sketch and paste this code:

Code: Select all

from pivy import coin
import time
from FreeCAD import Base
cam = FreeCADGui.ActiveDocument.ActiveView.getCameraNode()
trajectory = Gui.Selection.getSelectionEx()[0].Object.Shape.Edges
for edge in trajectory:
  startPoint = edge.valueAt( 0.0 )
  endPoint = edge.valueAt( edge.Length )
  dirVector = ( endPoint - startPoint ).normalize()
  currentPoint = startPoint
  while (currentPoint - startPoint).Length < edge.Length:
    currentPoint = currentPoint + dirVector
    cam.position.setValue(currentPoint + Base.Vector( 0,0, 10) )
    cam.pointAt( coin.SbVec3f( endPoint[0], endPoint[1], endPoint[2]+10) , coin.SbVec3f( 0, 0, 1 ) )
    Gui.updateGui()
    time.sleep(0.005)

More info and improved version in my blog.

P.D.: I've already posted this at the FreeCAD google+ page, but I don't know up to which point is connected with the forum, if this feels like spam, please tell me and I will post only here or there ;)
FreeCAD scripts, animations, experiments and more: http://linuxforanengineer.blogspot.com.es/
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
danielfalck
Posts: 395
Joined: Fri Oct 07, 2011 8:58 pm
Location: Beaverton,Oregon, USA
Contact:

Re: Tour camera animation

Postby danielfalck » Sat Nov 15, 2014 3:46 pm

Please post your FreeCAD adventures in both places, but post here first :)
You are doing some very interesting things.
jmaustpc
Posts: 9630
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Tour camera animation

Postby jmaustpc » Sat Nov 15, 2014 4:07 pm

yes, I also think you should post in both if you want to, as a lot of people will not look at both location. :)
User avatar
sgrogan
Posts: 5636
Joined: Wed Oct 22, 2014 5:02 pm

Re: Tour camera animation

Postby sgrogan » Sat Nov 15, 2014 4:10 pm

@JMG

Way Cool!

Please keep posting here!
User avatar
JMG
Posts: 278
Joined: Wed Dec 25, 2013 9:32 am
Location: Spain
Contact:

Re: Tour camera animation

Postby JMG » Sat Nov 15, 2014 5:17 pm

Thanks for your replies, I was a bit concerned about that ;)
I'll keep both places up to date :D

About the tour camera, I have improved it: now it works over tracks built up from several sketches and moves smoothly.
I created a mini tutorial too.
FreeCAD scripts, animations, experiments and more: http://linuxforanengineer.blogspot.com.es/
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Tour camera animation

Postby NormandC » Sat Nov 15, 2014 5:30 pm

JMG wrote:if this feels like spam
How can anything related to FreeCAD feel as spam? :D
jmaustpc
Posts: 9630
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Tour camera animation

Postby jmaustpc » Sun Nov 16, 2014 3:56 am

normandc wrote:
JMG wrote:if this feels like spam
How can anything related to FreeCAD feel as spam? :D

OH, actually quite easily Norm...like this :D
spamcan.fcstd
(924.21 KiB) Downloaded 76 times
which looks like this
spamcan.jpeg
spamcan.jpeg (11.42 KiB) Viewed 5088 times
:)

Jim
User avatar
clintonsam75
Posts: 291
Joined: Thu Jun 19, 2014 5:54 pm
Location: South Korea
Contact:

Re: Tour camera animation

Postby clintonsam75 » Mon Nov 17, 2014 7:27 am

That's very clever. I think this is the first time I've seen the camera move instead of an object on a YouTube video concerning FreeCAD.
User avatar
microelly2
Posts: 4626
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Tour camera animation

Postby microelly2 » Mon Nov 17, 2014 8:28 am

I have seen the animation of JMG already last week and placed the idea into my workbench.

http://youtu.be/GzNVr-lprMo

Next step will be to use perspective camera and create 3D
User avatar
microelly2
Posts: 4626
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Tour camera animation

Postby microelly2 » Mon Nov 17, 2014 6:28 pm

Todays result with the moving camera

http://youtu.be/pigAHmIVKr8

The base for the camera path is the blue DWire which is 100 above the earth
The camera directs to the gray cylinder (0,0,0).

The red path is the way of the camera in height 1000

The Foot point of the camera is simulated by the blue cube.

The camera is still orthogonal.

The red cube rotates with center (20, -100, 0)
The green square rotates arount the origin (0, 0, 0)

Render time was 100 sec for 1000 frames.
Attachments
movingcamera.png
movingcamera.png (44.49 KiB) Viewed 4993 times