How can I detect bounding box face?

Hi, it’s been a while everyone.
I’m making a fun game with Play Canvas.

But, I get a big problem.
The objects are aligned by the center coordinates of the bounding box.

Now:

Want Like this:

Here Is my project: link

Any kind of answer is fine. Please help me. :slightly_smiling_face:

Hi @Hizard,

I’m not fully certain I understand the problem, but you can move the pivot point by creating a parent entity and adding your model as a child. Afterwards move the child upwards so the pivot is at the lowest point of the model.

In addition if required to change the position of the collision shape you can do so by using the Position Offset property:

image

1 Like

I understand that you’re facing a problem with the alignment of objects based on the center coordinates of their bounding boxes. I can give you some general suggestions on how to approach this issue.

  1. Adjust object positions manually: If you want to align objects differently than their default center coordinates, you can manually adjust their positions. You can modify the position property of each object’s transform component to move them to the desired location. For example, if you want an object to be aligned to the bottom-left corner, you can set its position to be half of its width and height in negative values.
  2. Modify pivot points: The pivot point determines the origin of rotation and scaling for an object. By default, it is located at the center of the object’s bounding box. You can change the pivot point to align with a different position within the object. This can be done by adjusting the pivot property of the object’s transform component. Keep in mind that changing the pivot point affects the object’s transformation behavior.
  3. Use parenting: If you want to align objects relative to each other, you can consider using parenting. By making one object the parent of another, the child object’s position will be relative to the parent. You can set up a hierarchy of parent-child relationships to achieve the desired alignment.

Please note that these suggestions are general approaches, and the specific implementation may depend on the structure and requirements of your game. If you can provide more details or share the link to your project, I can offer more specific guidance tailored to your situation.

1 Like