Rotate the spaceship

Can we rotate the spaceship with touch functionality . The reference is the Space Rocks game.Thanks

Hi @regeme,

Check this example on how it rotates the object using the mouse:

And afterwards check the touch input examples on how to rework that with touch events:

Thanks for quick response im using this but and its work once i do the movment with finger then it disappear and once i touch again then its appear
here is the code .Thanks

Can you share your full project?

ok let me share the full project with you

You are using the same callback for both the mouse and the touch events. That won’t work because the event returned by touch input includes one or more gestures.

You should check the model viewer starter kit, it’s available when you create a new project. There you will find a script called orbit-camera.js, it includes an elaborate implementation of how touch input works, in addition to mouse input.

Notably the touchstart, touchmove and touchend events.

1 Like