Start Animation from button or annotation?


(Nleclercq74) #1

Hi, I am newbie and would like to know if we can start differrent animation when I click on button or with annotation in the viewer.

For example, I am a front of a door, when I click on it : start Animation open door or when i click on annotation in viewer, it opens door :slight_smile:

I know that is already asked , I saw some topics but no response
aybe shaderbytes or James coul help me (and others interested personn by this feature)

Many Thanks


#2

Hi,

Nothing in the regular viewer for interactivity like that yet, but you can do more advanced things with the Viewer API

https://sketchfab.com/developers/viewer


(Bart) #3

@james I saw that you can get a list of animation ID's in the current scene and that you can trigger them individually. Is there a way to get a callback when clicking on a specific object or material inside the viewer?


#4

@bartv it's not in the documentation yet, but yes:

api.addEventListener( 'click', function(e) {
    // Do stuff
});

Where

  • e.position3D is the coordinates of the click in 3D space
  • e.position3D is the coordinates of the click in the 2D canvas
  • e.normal is the vector of the normal at that point
  • e.instanceID is the clicked geometry node's ID
  • e.material is the clicked material object

You can see a live example in the Measurements Lab.


(Nleclercq74) #5

Hello

Thanks for you replies...I will look soon, but a demo or a tutorial will help me better :wink: (and other people too)


#6

@klaasnienhuis @shaderbytes do either of you have a public example of the picker at the moment?


(Shaderbytes) #7

here you go , http://www.shaderbytes.co.za/sketchfab/development/xbox_labs_configurator/


#8

Nice thanks :+1:


(Shaderbytes) #9

in this example since only an instance id is returned of a geometry node , i did a sneaky lookup to get to the matrix transform node. That been said The lookup storage is probably going to change at some point. I found issues with my tool and shortest link lookups when been used on animated rigs. anyway all the logic is there im sure the OP can make sense of it.


(Shaderbytes) #10

@bartv the animation system desperately needs some love. You cant trigger a single animation at all. The looping system is not on a per animation basis. Also porblems with the retrurn timelapsed/ end of frame ..end of animation.


(Klaasnienhuis) #11

Here's another sample of the object picker in action: http://www.3dmodelpublisher.com/Samples/ObjectPicker/


#12

@klaasnienhuis thanks!

@shaderbytes are the methods not working or you need something else?

seekTo
getAnimations
setCurrentAnimationByUID
getCurrentTime
setCycleMode

(Shaderbytes) #13

@james
no the issues is the current cycle mode system, you cant trigger just one animation have it play and stop when it is finished. this is because your looping mode is not applicable to each individual animation but rather to the animation list itself.

the developers need to look at the legacy animation system of unity for an idea of structure . You have an animation component and you have animation clips. Animation clips have there own looping mode. So it is possible to set some to play only once and at the same time for other clips you can tell them them to loop. You assign the animation clip to the animation component. You control the animation clip though the animation component but it respects the local looping mode of each clip.

you guys are half way there since the animation list resembles the animation component. You just need to add a looping mode to each clip.

Also for seekTo in the viewer you can pause and drag the slider to the very end and you end up on the last keyframe. Via the api if you set the seekto to the duration , it loops back on itself, it does not stop at the last keyframe.


(Emerson215) #14

Hello, I am also a newbie in here.want to learn from here.