engine icon indicating copy to clipboard operation
engine copied to clipboard

Rectangle - with position, orientation and size that can be intersected with Ray and other Shapes.

Open Maksims opened this issue 8 years ago • 5 comments

Like with BoundingBox and few other shapes, it would be good to have a rectangle, that is much simpler shape than box, and would be useful in many cases.

It would have position, rotation and size (not halfExtents please). And would have functionality to check if it intersects with ray or other shapes.

Maksims avatar Mar 27 '17 10:03 Maksims

Is this as straightforward as adding 'rectangle.js' in 'engine/src/shape' following the practices in the shapes in that directory? For clarification; you're asking for a rectangle, not a rectangular prism, yeah?

leecommamichael avatar Aug 15 '17 12:08 leecommamichael

I'd also add a circle.

(not halfExtents please).

That would make it harder to switch between rect/existing aabb. I would keep the halfExtents approach (or change both).

guycalledfrank avatar Aug 15 '17 12:08 guycalledfrank

@Maksims I am new to contributing to open source projects. However, this is my approach in solving the issue:

Step-1: Creating a rectangle.js in the src/core/shape to define the Rectangle {} class

Image

Step-2: Exporting Rectangle {} class in src/index.js

Image

Step-3: Adding rectangle.test.js file in test/core/shape to add four Rectangle {} class-specific test cases

Image

Step-4: The Result -> As a result, 1580 + 4 (Rectangle {} class) test cases are passed.

Image

Can you assign me this issue? Also, can I generate the pull request for the issue?

Hitesh-Nagpure avatar Nov 21 '25 10:11 Hitesh-Nagpure

@Maksims The Vercel deployment check fails due to missing authorization, since I’m an external contributor. Please let me know if I need to do anything else.

Hitesh-Nagpure avatar Nov 22 '25 11:11 Hitesh-Nagpure

Your PR will be picked up and reviewed by one of the PlayCanvas staff when they have time. I'm an outside contributor just like yourself.

Maksims avatar Nov 22 '25 12:11 Maksims