Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCPhysics Enhancements #479

Open
slembcke opened this issue Jan 7, 2014 · 2 comments
Open

CCPhysics Enhancements #479

slembcke opened this issue Jan 7, 2014 · 2 comments

Comments

@slembcke
Copy link
Contributor

slembcke commented Jan 7, 2014

Smooth Segment Collisions. (easy-ish?)

Chipmunk supports "smooth" line segment collisions, where you give a segment information about it's neighbors and it prevents you from colliding with the cracks between the segments. The deferred nature of CCPhysics made this a little awkward to support so I shelved the feature temporarily. I had an idea to support this with a new Chipmunk feature.

Optional CCPhysicsNodes (easy-ish?)

Have already gotten some feedback that people don't like CCPhysicsNodes or don't understand why they exist. Fair enough. Requiring them may have been a bad idea instead of making them optional.

My current thought to fix it is to move much of the CCPhysicsNode functionality to a separate CCPhysicsSpace object. Make a protocol with a property to return a CCPhysicsSpace object. Make CCPhysicsNode and CCScene implement the protocol. Then every scene already has everything it needs to support CCPhysics without having to make a CCPhysicsNode, but at the same time it's still possible to create extra CCPhysicsNode instances.

Physics Grabbing. (Easy)

ChipmunkMultiGrab is a pretty handy utility class. It allows you to implement multi-touch physics interaction fairly easily. There is a push and a pull mode to it, and they are mutually inclusive. The pull mode is the more obvious of the two. When you touch a shape it will add a joint to it and let you drag it around the screen. Push mode happens when you touch the screen where there isn't a shape. Instead it adds one for your finger so you can nudge other shapes around. So basically it implements the two ways that you would interact with objects laying on a table using your finger. It's all properly force limited and works using constraints so it's fairly hard to break it.

I think this might be as easy as CCPhysicsGrabNode subclass, overriding hitTestWithWorldPos: and implementing the CCResponder methods to pass the touches on to ChipmunkMultiGrab.

Kinematic Bodies. (easy)

The code for this already exists, and is only commented out of the public API because there was a lot of confusion about what kinematic bodies were.

Interpolation. (medium)

Currently there are no options for interpolating rigid body positions for the non-fixed update loop. It's probable that people are going to run into issues with the motion of their physics stuttering even if the framerate is smooth if they start playing around with fixed update settings. Avoiding this would be a good thing.

This isn't too hard to implement, though making it work along with actions makes it much harder.

Joints. (indeterminate)

CCPhysics only supports a basic set of joints. I was conservative about adding more joint types because they are a real pain to support and document all of the different variations that are already in Chipmunk. I implemented the four most common joints from Chipmunk.

I have some potentially big ideas about configurable joints in Chipmunk that might change how I want to go forward with them in CCPhysics.

Projectile Bodies. (medium)

A body with a ray query instead of a shape. This allows for very cheap swept collision bullets without the expense of full swept collisions. I haven't figured out a sensible way for this to fit in with the regular collision delegates though.

Actions. (hard)

There has already been a lot of discussion about this here: #381. Short summary is that actions and physics integrate together in Cocos as poorly as the equivalent features in SpriteKit or Unity. There is a lot of room for improvement.

@dissidently
Copy link

Where do I pay for these?

On Mon, Jan 6, 2014 at 4:16 PM, slembcke notifications@github.com wrote:

Smooth Segment Collisions. (easy-ish?)

Chipmunk supports "smooth" line segment collisions, where you give a
segment information about it's neighbors and it prevents you from colliding
with the cracks between the segments. The deferred nature of CCPhysics made
this a little awkward to support so I shelved the feature temporarily. I
had an idea to support this with a new Chipmunk feature.
Optional CCPhysicsNodes (easy-ish?)

Have already gotten some feedback that people don't like CCPhysicsNodes or
don't understand why they exist. Fair enough. Requiring them may have been
a bad idea instead of making them optional.

My current thought to fix it is to move much of the CCPhysicsNode
functionality to a separate CCPhysicsSpace object. Make a protocol with a
property to return a CCPhysicsSpace object. Make CCPhysicsNode and CCScene
implement the protocol. Then every scene already has everything it needs to
support CCPhysics without having to make a CCPhysicsNode, but at the same
time it's still possible to create extra CCPhysicsNode instances.
Physics Grabbing. (Easy)

ChipmunkMultiGrab is a pretty handy utility class. It allows you to
implement multi-touch physics interaction fairly easily. There is a push
and a pull mode to it, and they are mutually inclusive. The pull mode is
the more obvious of the two. When you touch a shape it will add a joint to
it and let you drag it around the screen. Push mode happens when you touch
the screen where there isn't a shape. Instead it adds one for your finger
so you can nudge other shapes around. So basically it implements the two
ways that you would interact with objects laying on a table using your
finger. It's all properly force limited and works using constraints so it's
fairly hard to break it.

I think this might be as easy as CCPhysicsGrabNode subclass, overriding
hitTestWithWorldPos: and implementing the CCResponder methods to pass the
touches on to ChipmunkMultiGrab.
Kinematic Bodies. (easy)

The code for this already exists, and is only commented out of the public
API because there was a lot of confusion about what kinematic bodies were.
Interpolation. (medium)

Currently there are no options for interpolating rigid body positions for
the non-fixed update loop. It's probable that people are going to run into
issues with the motion of their physics stuttering even if the framerate is
smooth if they start playing around with fixed update settings. Avoiding
this would be a good thing.

This isn't too hard to implement, though making it work along with actions
makes it much harder.
Joints. (indeterminate)

CCPhysics only supports a basic set of joints. I was conservative about
adding more joint types because they are a real pain to support and
document all of the different variations that are already in Chipmunk. I
implemented the four most common joints from Chipmunk.

I have some potentially big ideas about configurable joints in Chipmunk
that might change how I want to go forward with them in CCPhysics.
Projectile Bodies. (medium)

A body with a ray query instead of a shape. This allows for very cheap
swept collision bullets without the expense of full swept collisions. I
haven't figured out a sensible way for this to fit in with the regular
collision delegates though.
Actions. (hard)

There has already been a lot of discussion about this here: #381#381.
Short summary is that actions and physics integrate together in Cocos as
poorly as the equivalent features in SpriteKit or Unity. There is a lot of
room for improvement.


Reply to this email directly or view it on GitHubhttps://github.com//issues/479
.

@slembcke
Copy link
Contributor Author

Configurable physics debug colors?
#470

The debug drawing should also be updated to render the rounded corners of polygons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants