Moving Entity

Hello I have parent entity which is an empty container and child entities like 3d UI and render entity,
I want to move the entity to raycast result position but without snapping entity to cursor center if that makes sense.

Something like this:

Hi @Lukas_31,

The link you shared is password protected and not available. Try sharing a public url.

1 Like

sorry, here is new link: Screen Recording 2023-09-28 at 7.12.43 PM.mov - Google Drive

I made some progress:

Basically, I want just to move entity from pivot point without this janky movement that happens. Works nice with corners:

  • I have pivotPoint entity as child of furniture item
  • I’m checking if intersecting with bounding box then I Set pivotPoint to new location
  • on Mouse movement I do regula raycast from camera to screenWorld
  • on mouse move I also do this calculation:
const draOffset = new pc.Vec3()
const offset = pivotPoint.getWorldTransform().getTranslation().sub(bbox.center.clone());
dragOffset.sub2(result. Point, offset);
this.currentEntity.setPosition(dragOffset.x, result.point.y, dragOffset.z);

I just want pivotPoint to work as origin for the furniture entity