Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Ticket #1 (closed enhancement: fixed)

Opened 11 years ago

Last modified 11 years ago

Space.getShapeAtPoint support for static shapes

Reported by: Ralith Assigned to: somebody
Priority: minor Milestone:
Component: component1 Version:
Keywords: space getshapeatpoint static Cc:

Description

Space.getShapeAtPoint does not currently support static shapes. This patch remedies that.

Attachments

staticShapeSelect.diff (411 bytes) - added by Ralith on 05/14/08 20:11:18.
Patch to support picking of static shapes via getShapeAtPoint

Change History

05/14/08 20:11:18 changed by Ralith

  • attachment staticShapeSelect.diff added.

Patch to support picking of static shapes via getShapeAtPoint

(follow-ups: ↓ 2 ↓ 3 ) 05/14/08 20:16:53 changed by Ralith

By the way, might there be a better-than-O(n) way to do this?

(in reply to: ↑ 1 ; follow-up: ↓ 5 ) 05/15/08 11:17:12 changed by zzzzrrr

Replying to Ralith:

By the way, might there be a better-than-O(n) way to do this?

For polygons, it's a simple point in polygon test. If you know of a better algorithm please let me know.

I'll have to think a little about intersecting a segment with a point.... As far as static bodies are concerned, why do you need to grab them with the mouse since they are static and cannot move anyway?

(in reply to: ↑ 1 ) 05/15/08 20:34:57 changed by Anonymous

Replying to Ralith:

By the way, might there be a better-than-O(n) way to do this?

I'm also exploring the option of representing the mouse with a small rigidbody circle and a pivot joint. This would make it much faster than O[n]..

BTW, the removeRigidbody is fixed. I've also added removeJoint.

05/17/08 17:13:22 changed by zzzzrrr

  • status changed from new to closed.
  • resolution set to fixed.

Fixed

(in reply to: ↑ 2 ; follow-up: ↓ 6 ) 05/20/08 06:14:25 changed by Ralith

  • status changed from closed to reopened.
  • resolution deleted.

Fixed? The patch doesn't seem to be in SVN.

Replying to zzzzrrr:

I'll have to think a little about intersecting a segment with a point.... As far as static bodies are concerned, why do you need to grab them with the mouse since they are static and cannot move anyway?

I don't want to grab them with the mouse; that's not the purpose of this function. Static shapes are still shapes, and thus it seems logical for this function to not ignore them. My use for this is to enable *selection* of static shapes; although not yet implemented, a planned feature for my sandbox is the editing of physical properties such as elasticity and friction, which, afaik, static shapes have.

(in reply to: ↑ 5 ) 05/20/08 13:53:29 changed by Anonymous

  • status changed from reopened to closed.
  • resolution set to fixed.

Replying to Ralith:

Fixed? The patch doesn't seem to be in SVN.

It's fixed. You can select any shape, static or not. With segments make sure you set the line thickness so you can grab it with the mouse.

Check the demos for an example of selecting static shapes.

05/20/08 23:44:22 changed by zzzzrrr

Added method getRigidBodyAtPoint for convenience, although you can also get the rigid body from shape.rBody

05/21/08 03:52:38 changed by Ralith

Oh, missed that; confirmed to work in fizziks. My O(n) comment was in relation to checking *every* shape for the given point, versus taking advantage of existing infrastructure I conjectured blaze *might* have for only scanning nearby shapes. I don't actually know any relevant techniques, and am just speculating.