Moving Mesh objects with RigidBody

Hii,

For the last couple of days I’ve been trying to solve a problem which I can’t seem to figure out.
Im trying to move the following code in the x,z and y coordinates. Im not just trying to move the object but also has the behaviour to detect other objects and have boundaries

I have try wrapping the code in a TransformControls and that allows me to move the object around but it doesn’t respect the boundaries and detect collisions.

I also tried moving it with type kinematicPosition but I lose the fysica. Is there a possibility to have type dynamic and use the TransformControls with dynamic

      <RigidBody
          type={itemType}
          colliders="hull"
          restitution={0.2}
          friction={1}
          ref={rigidBodyRef}
          {...(item.scale !== 0 ? { scale: item.scale } : {})}
          rotation={[0, item.rotation, 0]}
        >
          <group
        
            onPointerDown={handlePointerDown}
            onClick={handleClick}
            onDoubleClick={handleDoubleClick}
            position={[0, 0, 0]}
          >
            <primitive object={scene} {...(item.scale !== 0 ? { scale: item.scale } : {})} />
          </group>
        </RigidBody>
    <TransformControls 
        ref={transform} 
        mode="translate" 
        showY={false} 
        size={1}
        enabled={true} >
        <RigidBody
          type={itemType}
          colliders="hull"
          restitution={0.2}
          friction={1}
          ref={rigidBodyRef}
          {...(item.scale !== 0 ? { scale: item.scale } : {})}
          rotation={[0, item.rotation, 0]}
        >
          <group
        
            onPointerDown={handlePointerDown}
            onClick={handleClick}
            onDoubleClick={handleDoubleClick}
            position={[0, 0, 0]}
          >
            <primitive object={scene} {...(item.scale !== 0 ? { scale: item.scale } : {})} />
          </group>
        </RigidBody>
    </TransformControls>

Make an invisible, kinematic "cursor"sphere

Add a point to point. Constraint from “cursor” to rigidbody.. and move the cursor.

Or manipulate velocity of rigidbody directly to make it move.. but can be tricky to get that right.

Do you have example or starting point? Im fairly new to ThreeJS

can somebody help me?