TresCom Forums

TresCom : The Trespasser Fan Gateway...
It is currently Fri Sep 21, 2018 10:23 pm

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 35 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: Tue Sep 09, 2003 5:56 pm 
Offline
-=TresCom Developer=-
-=TresCom Developer=-

Joined: Mon Jul 22, 2002 12:35 pm
Posts: 1845
Location: Holland, Europe
Code:
utility AsaExp "AsaExp"
(
 group "About"
 (
  label lab1 "Animation Script Exporter"
  label lab2 "Version 0.1 Beta"
  label lab3 "by Martijn Buijs"
  label lab4 "Copyright TresCom, 2003"
 )
 group "Export"
 (
  checkbox chkForcedRate "Forced Framerate" enabled: false checked: true
  button cmdExport "Export Animation"
 )
 on cmdExport pressed do
 (
  filename = getSaveFileName caption:"Export Animation" types:"Animation Script (*.asa)|*.asa|Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
  if filename != undefined then
  (
   fileobj = createfile filename
   format "version 2\n" to: fileobj
   if chkForcedRate.checked then
   (
    format "forced_rate %\n\n" frameRate to: fileobj
   ) else (
    format "forced_rate 0\n\n" to: fileobj
   )
   for i=1 to objects.count do
   (
    ExpObj objects[i] chkForcedRate.checked
   )
   close fileobj
  )
 )
)

fn WriteFrames obj =
(
 for j=animationRange.start to animationRange.end do
 (
  sliderTime = j
  format "frame %\n" ((j/160) as integer) to: fileobj
  format "pos % % %\n" obj.position.x obj.position.y obj.position.z to: fileobj
  format "rot % % % %\n" obj.rotation.x obj.rotation.y obj.rotation.z obj.rotation.w to: fileobj
  format "scale %\n\n" ((obj.scale.x + obj.scale.y + obj.scale.z) / 3) to: fileobj
 )
)

fn ExpObj obj forcedrate =
(
 --MaxScript is a bit buggy :-(
 --Workaround starts here...
 if (superclassof(obj) == GeometryClass) do
 (
  format "object %\n\n" obj.name to: fileobj
 )
 --...and ends here.
 case superclassof(obj) of
 (
  GeometryClass:
   --format "object %\n\n" obj.name to: fileobj --this crashes for some weird reason, see workaround above
   if forcedrate then
   (
    WriteFrames obj
   ) else (
    --WriteKeyFrames obj
   )
  camera:
   if classof(obj) == FreeCamera do
   (
    format "object Camera\n\n" obj.name to: fileobj
    if forcedrate then
    (
     WriteFrames obj
    ) else (
     --WriteKeyFrames obj
    )
   )
 )
 format "end_object\n\n" to: fileobj
)


Here's the maxscript code. It's a bit of a mess but I'll clean it up in a future version.

Works with all primitives and meshes (Geometry class to be exact). What it does is loop thru all objects and prints the position, rotation, scale (averaged x,y,z scale) for each frame. That means that bone systems, noise controllers (for camera shake for example) and other helpers/tools in MAX can be used to animate them.

Haven't implemented keyframes. Would make the animation scripts smaller, but it doesn't work for non-linear trajectories.
Also, MAX's camera rotations (FreeCamera only) don't apear be like that of other nodes and I haven't figured out how it does work.

It's pretty cool to animate stuff like this... :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 09, 2003 11:09 pm 
Offline
-=TresCom Developer=-
-=TresCom Developer=-

Joined: Thu Nov 14, 2002 8:35 pm
Posts: 113
I did some quick tests trying to animate a dinosaur. Can animate "RaptorB" but the dino is frozen in default position. Then for the following, must at least mention RaptorB in the script or nothing at all happens: can animate the physics objects ("Head" etc.) fine. But when trying to move joints the dino just sat there twitching.
Don't let me put you off trying yourself, as animated dinos would be very cool and my tests weren't very thorough.

(From my tests it seemed that in Trespasser the default Camera orientation is Y-axis "forward" and Z-axis "up", and the rotation is applied to that.)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 28, 2004 9:22 pm 
Offline
-=TresCom Developer=-
-=TresCom Developer=-

Joined: Mon Jul 22, 2002 12:35 pm
Posts: 1845
Location: Holland, Europe
Hmm, I checked out the generated .asb files and it seems as if these include many more keyframes than the original ASCII script (hence the bigger file size). My 3d file visualization app shows a swirling rows of dots (forming a path), which most likely are positions, an curve which probably are the rotations.

Not really that interesting, but I'm trying to figure out whether these could have been use for dino animations...

_________________
http://www.bytehazard.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 28, 2004 11:11 pm 
Offline
-=TresCom Developer=-
-=TresCom Developer=-
User avatar

Joined: Sun Nov 10, 2002 10:26 pm
Posts: 4796
Location: That country nobody likes (you know the one)
Just a personal opinion, but I think that were just considering the animations for cinematic views and perhaps puzzlin problems like those energy cells in pv (though that's probably a stretch).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 29, 2004 10:20 am 
Offline
-=TresCom Developer=-
-=TresCom Developer=-

Joined: Mon Jul 22, 2002 12:35 pm
Posts: 1845
Location: Holland, Europe
Yeah, I'm afraid you are right. They wouldn't need the camera to move for any dino animations, but I'm still hoping that the animations wheren't hard coded (in the form of mathematical calculations) so thy can be altered to our needs...

_________________
http://www.bytehazard.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 35 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB® Forum Software © phpBB Group