i used this for rotation
**Note :this line **
console.log(βTouch Move Event:β, dragData)
const dragDeltaX = dragData.deltaX ?? dragData.movementX
dragDeltaX comes always null
code returned *
*
// β ONE-FINGER DRAG FOR ROTATION β
.listen(eid, ecs.input.SCREEN_TOUCH_MOVE, (e) => {
const {lastPlaced} = schemaAttribute.get(eid)
if (!lastPlaced) return
const dragData = e.data as any
console.log('Touch Move Event:', dragData)
*// Safe access to deltaX (handle null/undefined)*
const dragDeltaX = dragData.deltaX ?? dragData.movementX
if (dragDeltaX == null) return *// skip if no movement yet*
const rotationSpeed = 0.005
const currentRotation = ecs.Quaternion.get(world, lastPlaced)
if (currentRotation) {
ecs.Quaternion.set(world, lastPlaced, {
x: currentRotation.x,
y: currentRotation.y + dragDeltaX \* rotationSpeed,
z: currentRotation.z,
w: currentRotation.w,
})
}
})