DAEMC2 Update
In reply to:
joe
How would I get a model to play in reverse? Great class!
I updated DAEMC2 (rev31) with a new property called .inReverse witch can be true (play backwards) or false (play foward).
Now take in consideration that frame scripts will be called no matter the orientation of the animation… so loops and things of that nature should be have into account.
joe 9:13 AM on 8 May 2009 Permalink |
Great update. Just not sure what the framescript is about or if I have to use it. The documentation doesn’t make much sense. I’m working with FLARToolKit and keep running into problems. Basically, what I’m trying to accomplish is having the DAE file play animations when the target area is located. When the target is lost the animation would animate out in reverse. The only thing I can accomplish with your class is to loop the animation. This is something I can already do with the default DEA papervision class. Any help would be great.
pablobandin 10:40 AM on 8 May 2009 Permalink |
ok that’s easy…
if( target_area_located ) {
model.currentFrameNumber = XXX; //the first frame of the desired animation….
model.play();
model.addFrameScript( lastXXX, goBackToFrameXXXandPlay ); //lastXXX is the last frame of that animation, goBackToFrameXXXandPlay is a function that make model.curentFrameNumber = XXX again…
}
else
{
model.inReverse = true;
model.addFrameScript( lastXXX, null); //delete the old frame script
model.addFrameScript( XXX, nowReturnToNormalBehavior); // you can cancel the reverse mode or keep looping by sending the animation to frame lastXXX… to cancel the reverse mode you do model.inReverse = false
}
pablobandin 10:47 AM on 8 May 2009 Permalink |
BTW frame script is a method that you use to call a function when the animation is on a desired frame… example:
model.addFrameScript( 2, doSomething);
…
function doSomething():void {
trace(“Hi i’m in frame 2″)
}
joe 3:45 PM on 8 May 2009 Permalink |
Thanks! But nothing happens. here is my code
public function CheckActive(e:Event):void{
if(super.isActive){
removeEventListener(Event.ENTER_FRAME, CheckActive);
model.currentFrameNumber = 1; //the first frame of the desired animation….
model.play();
trace(“is Active”);
}else{
model.inReverse = true;
addEventListener(Event.ENTER_FRAME, CheckActive);
trace(“not active”)
}
pablobandin 4:02 PM on 8 May 2009 Permalink |
you are removing the CheckActive listener if isActive and then the CheckActive is not called never again… that’s why the “else” is never called
joe 4:13 PM on 8 May 2009 Permalink |
ok I changed it to a timer. still nothing.
started = false;
startTimer = new Timer(100,0);
startTimer.addEventListener(TimerEvent.TIMER, CheckActive);
startTimer.start();
public function CheckActive(e:TimerEvent):void{
if(super.isActive && started == false){
//removeEventListener(Event.ENTER_FRAME, CheckActive);
started = true;
startTimer.stop();
model.currentFrameNumber = 1
model.play();
}
}
pablobandin 4:31 PM on 8 May 2009 Permalink |
same thing you are setting started to true and never again to false…
try this:
started = false;
startTimer = new Timer(100,0);
startTimer.addEventListener(TimerEvent.TIMER, CheckActive);
startTimer.start();
public function CheckActive(e:TimerEvent):void{
if(super.isActive ){
if(!started)
{
started = true;
model.currentFrameNumber = 1
model.play();
}
} else {
started = false;
model.inReverse = true;
}
}
joe 4:41 PM on 8 May 2009 Permalink |
That is the same as my code expect you broke it out. Yeah still not doing anything. I’m pretty sure the class only works if your extending Basic view (which I’m not doing). Its still a good class… just not working. I guess I’ll have to look what else is out there. Thanks for all your help.
pablobandin 5:01 PM on 8 May 2009 Permalink |
“That is the same as my code expect you broke it out” LOL are you sure? do you understand the code? did you test it? LOL dude… talking about n00bs…
pablobandin 4:58 PM on 8 May 2009 Permalink |
“only works if you extend BasicView” ? lol ? are you a graphic designer or something? i was trying to help but i see now that you have no idea of programming. My bad…
i suggest you to learn pogramming or get a programmer, because you obviously cant understand anything…
And by the way, try be more polite with people. Last time i answer you.
joe 5:09 PM on 8 May 2009 Permalink |
I didn’t think I was being rude. My apologizes. Sorry to took everything the wrong way. No reason for the personal attack. That was not polite. Actually I been work with flash since version 3. Been doing it for sometime. Yes I am a designer but does make me not understand your code. Maybe since I’m doing this all in flex make me less of designer in your eyes. Again thanks for the help and the insults. Hey I take no offense to it. I was just looking for a little help.
joe 5:19 PM on 8 May 2009 Permalink |
by the way I’m not extending Basic view because I’m already extending the FLARtool class. Would this have something to do with it?
Animatist 1:12 PM on 19 May 2009 Permalink |
Hi~ If I have a character with animation, I want to move his head follow mouse cursor, then I may use getchildbyname in code, does daemc2 support getchildbyname, coz I am a newbie please forgive me if my question is too newbie,thanks.
pablobandin 4:05 PM on 19 May 2009 Permalink |
yea, DAEMC is just an extension of DAE, so DAEMC = DAE.
Diego 3:41 PM on 3 June 2009 Permalink
Hola Pablo, Increible tu laburo che! I’ll write in eng. so everyone can understand
I’m trying to use DAEMC with FLARtoolkit, but it’s giving me error 1144 on DAEMC2.as (“Interface method play in namespace org.papervision3d.core.animation:|Animatable is implemented with an incompatible signature in class org.papervision3d.objects.special:DAEMC2″).
writing 4 ex: “modelo = new DAEMC2(true, null, 0);” already gives me this issue.
Any tip will be GREAT.
Abrazo
Diego
pablobandin 6:26 PM on 3 June 2009 Permalink
modelo = new DAEMC2(true, null, 0) eso te da problemas?
Que version del Papervision3d estas usando?
Fijate que la signature de play sea “public function play(clip:String=null):void” en toda la herencia hacia arriba. Calculo que tendrás un Papervision viejo…
Diego 7:14 AM on 4 June 2009 Permalink
Gracias por responder tan rápido che!
Estoy usando la última v. de PV3D que hay en el SVN.
Mirá, éste es mi public (la clase extiende PV3DARApp de FLARToolkit):
public function GauchoCaminante()
{
this.addEventListener(Event.INIT, this._onInit);
this.init(CAMERA_FILE, PATTERN_FILE)
// GAUCHITO / DAE
var mat:BitmapFileMaterial = new BitmapFileMaterial(“assets/scout_flat.jpg”);
var mp:MaterialsList = new MaterialsList();
mp.addMaterial(mat, “scout_red”);
gauchito = new DAEMC2(true, null, 0);
gauchito.load(“assets/scout.dae”,mp);
gauchito.rotationX = 0;
gauchito.rotationY = 180;
gauchito.scale = 0.2;
gauchito.z = 0;
this._baseNode.addChild(gauchito);
// END COLLADA
}
Me tira “Incompatible override” de DAEMC2.as
Alguna idea?
Desde ya, muchas gracias por tu atención
pablobandin 4:09 PM on 4 June 2009 Permalink
recién me entero que cambiaron el sistema de animación en papervision. Usá la revision 910 temporalmente si es urgente. Voy a tener que ver como funciona ahora el nuevo sistema y posteo una resolución a ver si DAEMC sigue siendo util. A mi me habian dicho hace tiempo que iban a meter DAEMC dentro de papervision… a ver si lo hicieron o me mintieron y se mandaron otra.
Diego 4:16 PM on 4 June 2009 Permalink
Por mi no te preocupes Pablo
Cualquier cosa que sepas, posteála que estoy revisando tu blog diariamente.
Espero buenas nuevas
saludos
Animatist 9:46 PM on 19 May 2009 Permalink |
Thanks for reply, but I am a newbie and meet errors when try to make a character head follow crusor move, but body keep still, can you give me hint to make this? Thank you very much in advance~
Animatist 11:00 PM on 20 May 2009 Permalink
Thanks and I have solved, just miss ‘true’ behind the child name, and I have learnt that I should study every command format before yelling help ; )
cyprus 8:10 AM on 12 August 2009 Permalink |
Hi, just found this and it seems to be a great class.
but I´ve some questions.
The idea is to take an dae animation and stop it by 6 Framelabels. The mc should play forward an backward to an asked Framelabel depending on which button was pressed.
Tweenmax can handle this but is it possible to set framelabels with daemc?
pablobandin 9:37 AM on 12 August 2009 Permalink |
i have discontinued this class, and no, it dosent have that, you’r gonna have to implement it by hand. But what you need is very simple> To get the frame label pass to this function the current frame and fill the $frameLabels array with the labels of your object… you should make that local var a parameter of the funtion that will be more flexible, i this this just to show the idea.
function getFrameLabel($frame:Number):String {
var $frameLabels:Object = { '1':'frame 1', '2':'frame 2 to 5', '5':'','6':'frame 6'}
var $currentLabel:String = '';
var $currentLabelFrame:Number = 0;
for (var $label:* in $frameLabels) {
if($frame>=Number($label) && Number($label)>$currentLabelFrame){
$currentLabelFrame = Number($label);
$currentLabel = $frameLabels[$label];
}
}
return $currentLabel;
}