View Full Version : 'Click to play' LW animations in Director?
Hi all
Hope someone can give me a couple of pointers if possible for an interactive 3D model in Director.
I have created an object in LW that has two layers (Component1 & Component2). I want these two objects to be joined together in their default state.
I have animated Component1 in Layout to move away from Component2 over 10 frames using normal keyframing. I have then exported the scene to Shockwave 3D and imported into Director. If I play the animation as default in Director, it plays fine. However, if I add the 'Play Animation' behaviour and tie it to the 'Mouse Left' behaviour (i.e. you click on Component1 to play the animation), then the animation won't play. The only way I can get it to play is to set it to not be locked to the objects axis, but then what happens is that the animation plays, but the object jumps from it's position and plays somewhere else on the screen.
Am I going about this in the right way? I've searched for a tutorial for producing this sort of 'exploded view' 3D object in Director, but as yet have drawn a blank.
Any help/advice is appreciated.
-: Deux :-
MentalFish
04-19-2005, 04:20 AM
A model animated inside of LightWave and exported to ShockWave3D has something called an animation modifier applied to it. This is a "tag" which you can tell the animation of one specific model to start or stop playing its animation. Make 2 behaviour scripts, one like this:
on mouseUp
member("myW3Dscene").model("myModel").keyframePlayer.pause()
end
and attach that to a stop/pause button graphic. To make it play again type this in the other behaviour script:
on mouseUp
member("myW3Dscene").model("myModel").keyframePlayer.play()
end
You also have a bonesPlayer modifier if the model contains bone animation.
petterms
Thanks very much for your reply. This is really helpful and I'll try it out later!
Happy rendering,
-: Deux :-
Ok, I've had a try with this and still no luck :(
I set up a scene where I loaded a single object with two layers: Object1 and Object2. I then animated each piece separately over 60 frames and exported the scene to Shockwave3D.
Once loaded into Director, I can play the animation by default (i.e. both pieces animate correctly together), but if I add your code to two control buttons and try to animate each piece individually it doesn't work. I'm sure I have the names of the objects entered correctly in the code, so I'm wondering if I need to start with two completely separate objects in LightWave first before I export.
Or is there something else I could be missing?
Cheers,
-: Deux :-
MentalFish
04-20-2005, 04:49 AM
can I see the .dir file please? zip and attach in a message here in the forum.
petterms
Yea, no problem.. Zip is attached and it includes the .w3d and .dir files. It's a really simple setup - 2 objects, each animated to move apart from each other (see this by turning 'Animated' on for the cast member). They are static to begin with and I'd like a button controlling each independantly to make them animate separately.
.dir file is from Director MX 2004 btw.
Cheers,
-: Deux :-
MentalFish
04-20-2005, 06:43 AM
In the property inspector of the model you have unchecked the Animation tag. This means it wont handle any animation, regardless of what you script it to do.
Direct To Stage (DTS) has been checked off too, resulting in very slow playback. Check it on again, and create the GUI next to the 3D view instead of on top of it.
Animations play automatically, so you need to stop it on starting up the movie. Create a Movie Script and type in this:
on startmovie
member("myW3Dscene").model("myModel1").keyframePlayer.pause()
member("myW3Dscene").model("myModel2").keyframePlayer.pause()
end
or create a Behaviour script like this:
on beginsprite
member("myW3Dscene").model("myModel1").keyframePlayer.pause()
member("myW3Dscene").model("myModel2").keyframePlayer.pause()
end
and attach it to the 3D view.
petterms
Thanks very much for this.. I'm beginning to understand how Director supports imported objects and the functions available to control them. I've looked up the help files for keyframePlayer, so I'm having a play with the settings now.
Cheers for the pointers,
-: Deux :-
petterms
Back to this subject again :)
Having tried the various keyframeplayer functions, what I'm now not understanding is how to play only up to a particular key frame in the animation, or even play a particular keyframe that night be halfway through.
Should I be setting a time period and play the animation up to that point, where the milliseconds correspond to the postion of the keyframe in the animation - i.e @30fps, keyframe 30 would be 1 second?
Or.. can I name keyframes inside LightWave before I export and call them directly using keyframeplayer?
For example, if I want to have a plug being pulled from a socket and then returned, do I animate the two sequences back to back in LW and then call them by name in Lingo, or can I animate one and play it in reverse? It seems there are not enough functions in keyframeplayer to do this sort of thing to me.
Thanks,
-: Deux :-
MentalFish
04-22-2005, 06:31 PM
To be honest, I have no clue. I havent done any of that stuff yet, but I can take a look into it at some time. You could also join this mailinglist to get more detailed answers:
http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
petterms
Ok dude, thanks for getting back to me and for the link... I'll join it now!
Best,
-: Deux :-
enidmelanie
08-02-2005, 03:51 AM
Hi Deux,
did you get to solve that problem of yours? I'm having the same one and am therefore really interested in what you found out!
Thanks for any help,
Melanie
Hi Melanie
Ooh, this was some time ago, but I managed to find and dig out the .DIR file I had been working on. Basically, yes it got solved with petterms' suggested code above. I assigned the playback of the animation to a button (but it also equally worked using the object itself) and it all worked out fine.
I'd suggest trying the code above and if you're still having problems, give us a shout again.
Best regards and happy Directing,
-: Deux :-
enidmelanie
08-03-2005, 06:17 AM
Hi Deux,
thanks for your quick reply!
Actually I am having an different problem now:
when I use member("...").model("...").keyframePlayer-play() my play-button works fine.
But when I try to specify my settings moin more detail - play("motion", start-time, end-time,...) the following occurs:
The animation plays twice. First completely from beginning to end and afterwards "correctly" (from frame x to y as specified in the parathesis.
I visited the directorforum where somebody seems to be having the same problem, but hasn't received any answers. :(
Do you have any ideas as to what I'm doing wrong?
Thanks for your help!
Melanie
Hi Melanie
Been a while since I worked in Director.. bit rusty! I'm struggling to get my animation to play between a start frame and end frame, but it doesn't play twice. Are you able to send through your source files or an example of the problem in a setup file for us to take a look at?
Cheers,
-: Deux :-
MentalFish
08-03-2005, 07:13 AM
Just a wild guess here: Perhaps it plays it twice because bonesPlayer has a playlist array that contains the whole animation as its first entry.
The following Lingo adds the motion named Fall to the end of the bonesPlayer playlist of the model named Walker. When all motions before Fall in the playlist have been executed, Fall will play one time from beginning to end.
sprite(1).member.model("Walker").bonesPlayer.queue("Fall", 0, 0, -1, 1, 0)
Perhaps you can do a removeLast() before you try to add the motion you want:
member("MyWorld").model("Walker").bonesPlayer.removelast()
then do the play function as you described earlier.
enidmelanie
08-06-2005, 05:11 PM
Hey,
thanks so much for all your help! I lost this link and had some trouble getting back here. Sorry for the late reply - won't happen again!
Actually I figured that last problem out! It WAS the removeLast()-command that was missing in the startMovie skript.
Now I am having new trouble though :mad:
I am trying to get my play, stop step forward/backward-buttons to work.
Especially my step-forward button ist giving me trouble because it simply doesn't stop when the animation is supposed to be over. I don`t get it. The frames it plays don't even exist in the Maya file!
I'll try to attach my Dummy with which I am testing the functions!
I have a deadline coming up and this is driving me crazy!
Thanks a lot for any help!
Melanie
Oh, man, I cannot attach a Director File.
Here's the source code for my next-step-button:
on mouseUp me
if member("seven_sticks_04_neu").model("pCube8").keyframePlayer.currentTime > 13333 then
member("seven_sticks_04_neu").model("pCube8").keyframePlayer.pause()
member("seven_sticks_04_neu").model("pCube8").keyframePlayer.positionReset = TRUE
else
member("seven_sticks_04_neu").model("pCube8").keyframePlayer.positionReset = FALSE
anfang = member("seven_sticks_04_neu").model("pCube8").keyframePlayer.currentTime
ende = anfang+2666
member("seven_sticks_04_neu").model("pCube8").keyframePlayer.play("pCube8-Motion0",FALSE,anfang,ende)
if member("seven_sticks_04_neu").model("pCube8").keyframePlayer.currentTime = ende then
member("seven_sticks_04_neu").model("pCube8").keyframePlayer.pause()
end if
member("seven_sticks_04_neu").model("pCube8").keyframePlayer.positionReset = TRUE
end if
end
enidmelanie
08-06-2005, 05:12 PM
400 Frames/30*1000=~13333 Milliseconds
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.