Jump to content
Search Community

Issues to target .gltf Objects with gsap

Boudi Salim test
Moderator Tag

Recommended Posts

Hello community, 

Hope that everyone is doing great,

I seem to have issues targeting .gltf objects in my THREE.Js scene with gsap for the animation. 

I've done an animation using gsap and THREE.Js Objects that work fine, we wanted to upgrade the THREE.Js objects to objects done with 3D Software and imported under .gltf extension. 

But when I call the gltf object, I have an error saying that the gltf is not defined. 

Maybe it's a simple issue, let me know if you have any idea how to make this work.

Thanks in advance.

See the Pen poPYOJj by Salim-Boudi (@Salim-Boudi) on CodePen

Link to comment
Share on other sites

On this part of your code:
 

function (gltf) {
                
  gltf.scene.scale.set(10, 10, 10);
  gltf.scene.position.set(0, 0, 0);
                
  scene.add(gltf.scene);


  gltf.animations; // Array<THREE.AnimationClip>
  gltf.scene; // THREE.Group
  gltf.scenes; // Array<THREE.Group>
  gltf.cameras; // Array<THREE.Camera>
  gltf.asset; // Object

  gsap.to(gltf.scene.position, {
    scrollTrigger: {
      start: "top top",
      end: "10%",
      markers: false,
      scrub: true,
      pin: true,
      toggleActions: "restart pause resume pause"
    },
    x: 2,
    y: 2,
    z: -1
  });

},

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...